Package org.eclipse.gef.zest.fx.jface
Class ZestContentViewer
java.lang.Object
org.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.gef.zest.fx.jface.ZestContentViewer
- All Implemented Interfaces:
IInputProvider,IInputSelectionProvider,ISelectionProvider
-
Field Summary
Fields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected javafx.embed.swt.FXCanvascreateCanvas(Composite parent, int style) Creates anFXCanvasinside of the given parentComposite.voidcreateControl(Composite parent, int style) Creates the control for thisZestContentViewerinside of the given parentComposite.protected EdgecreateEdge(ILabelProvider labelProvider, Object contentSourceNode, Node sourceNode, Object contentTargetNode, Node targetNode) Constructs and returns a newEdgeconnecting the given sourceNode and targetNode.protected GraphConstructs and returns a newGraphand inserts default attributes into it: layout algorithmprotected GraphcreateNestedGraph(Object contentNestingNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider) Creates aGraphnested in the node represented by the given contentNestingNode.protected NodecreateNode(Object contentNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider) protected voidcreateNodesAndEdges(IGraphContentProvider graphContentProvider, ILabelProvider labelProvider, Graph graph, Object[] contentNodes) protected GraphcreateRootGraph(IContentProvider contentProvider, ILabelProvider labelProvider) Returns an unmodifiable view of the content-node-map.Returns theIViewerthat displays the contents.javafx.embed.swt.FXCanvasReturns theILayoutAlgorithmthat is used for laying out the contents.protected SelectionModelRetrieves theSelectionModelused by the viewer (getContentViewer())protected voidhandleDispose(DisposeEvent event) protected voidinputChanged(Object input, Object oldInput) voidrefresh()voidsetLayoutAlgorithm(ILayoutAlgorithm layoutAlgorithm) Changes theILayoutAlgorithmthat is used for laying out the contents to the given value.voidsetSelection(ISelection selection, boolean reveal) protected StringConverts the givenColorinto a CSS string:"rgb(red,green,blue)".Methods inherited from class org.eclipse.jface.viewers.ContentViewer
getContentProvider, getInput, handleLabelProviderChanged, hookControl, labelProviderChanged, setContentProvider, setInput, setLabelProviderMethods inherited from class org.eclipse.jface.viewers.Viewer
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection
-
Constructor Details
-
Method Details
-
createCanvas
Creates anFXCanvasinside of the given parentComposite. TheFXCanvasserves acs the container for the JavaFXScenewhich renders the contents.- Parameters:
parent- The parentComposite.style- The SWT style bits to be used for the to be created canvas.- Returns:
- An
FXCanvasinside of the given parent.
-
createControl
Creates the control for thisZestContentViewerinside of the given parentComposite.- Parameters:
parent- The parentComposite.style- The SWT style for thisZestContentViewer, which will be forwarded to itsFXCanvascontrol.
-
createEdge
protected Edge createEdge(ILabelProvider labelProvider, Object contentSourceNode, Node sourceNode, Object contentTargetNode, Node targetNode) Constructs and returns a newEdgeconnecting the given sourceNode and targetNode. If the labelProvider implementsIGraphAttributesProvider, then attributes for the edge are determined using theIGraphAttributesProvider.getEdgeAttributes(Object, Object)methods and inserted into the edge.- Parameters:
labelProvider- This viewer'sILabelProviderfor convenience.contentSourceNode- The content element representing the source node of this edge.sourceNode- The already created sourceNodeof this edge.contentTargetNode- The content element representing the target node of this edge.targetNode- The already created targetNodeof this edge.- Returns:
- The new
Edge.
-
createEmptyGraph
Constructs and returns a newGraphand inserts default attributes into it:- layout algorithm
- Returns:
- A new
Graphwith default attributes.
-
createNestedGraph
protected Graph createNestedGraph(Object contentNestingNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider) Creates aGraphnested in the node represented by the given contentNestingNode.- Parameters:
contentNestingNode- The contentObjectthat represents the nesting node.graphContentProvider- This viewer'sIGraphContentProviderfor convenience.labelProvider- This viewer'sILabelProviderfor convenience.- Returns:
- The new
Graph.
-
createNode
protected Node createNode(Object contentNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider) Creates aNodefor the specified contentNode using theIContentProviderandILabelProvider. Moreover, the new node is put into the given contentToGraphMap.- Parameters:
contentNode- The contentObjectthat represents the node.graphContentProvider- This viewer'sIGraphContentProviderfor convenience.labelProvider- This viewer'sILabelProviderfor convenience.- Returns:
- The new
Node.
-
createNodesAndEdges
protected void createNodesAndEdges(IGraphContentProvider graphContentProvider, ILabelProvider labelProvider, Graph graph, Object[] contentNodes) - Parameters:
graphContentProvider- This viewer'sIGraphContentProviderfor convenience.labelProvider- This viewer'sILabelProviderfor convenience.graph- TheGraphfor which nodes and edges are created.contentNodes- Content elements which represent nodes that are to be created together with the edges between them.
-
createRootGraph
- Parameters:
contentProvider- TheIContentProviderfor this viewer.labelProvider- TheILabelProviderfor this viewer.- Returns:
- A complete
Graphconstructed by using the given providers.
-
getContentNodeMap
Returns an unmodifiable view of the content-node-map.- Returns:
- An unmodifiable view of the content-node-map.
-
getContentViewer
Returns theIViewerthat displays the contents.- Returns:
- The
IViewerthat displays the contents.
-
getControl
public javafx.embed.swt.FXCanvas getControl()- Specified by:
getControlin classViewer
-
getLabelProvider
- Overrides:
getLabelProviderin classContentViewer
-
getLayoutAlgorithm
Returns theILayoutAlgorithmthat is used for laying out the contents.- Returns:
- The
ILayoutAlgorithmthat is used for laying out the contents.
-
getSelection
- Specified by:
getSelectionin interfaceISelectionProvider- Specified by:
getSelectionin classViewer
-
getSelectionModel
Retrieves theSelectionModelused by the viewer (getContentViewer())- Returns:
- The
SelectionModeladapted to the viewer (getContentViewer()).
-
handleDispose
- Overrides:
handleDisposein classContentViewer
-
inputChanged
- Overrides:
inputChangedin classViewer
-
refresh
public void refresh() -
setLayoutAlgorithm
Changes theILayoutAlgorithmthat is used for laying out the contents to the given value.- Parameters:
layoutAlgorithm- The newILayoutAlgorithmto use.
-
setSelection
- Specified by:
setSelectionin classViewer
-
toCssRgb
Converts the givenColorinto a CSS string:"rgb(red,green,blue)".- Parameters:
color- TheColorto convert.- Returns:
- The corresponding CSS string.
-