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
-
Method Summary
Modifier and TypeMethodDescriptionprotected javafx.embed.swt.FXCanvas
createCanvas
(Composite parent, int style) Creates anFXCanvas
inside of the given parentComposite
.void
createControl
(Composite parent, int style) Creates the control for thisZestContentViewer
inside of the given parentComposite
.protected Edge
createEdge
(ILabelProvider labelProvider, Object contentSourceNode, Node sourceNode, Object contentTargetNode, Node targetNode) Constructs and returns a newEdge
connecting the given sourceNode and targetNode.protected Graph
Constructs and returns a newGraph
and inserts default attributes into it: layout algorithmprotected Graph
createNestedGraph
(Object contentNestingNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider) Creates aGraph
nested in the node represented by the given contentNestingNode.protected Node
createNode
(Object contentNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider) protected void
createNodesAndEdges
(IGraphContentProvider graphContentProvider, ILabelProvider labelProvider, Graph graph, Object[] contentNodes) protected Graph
createRootGraph
(IContentProvider contentProvider, ILabelProvider labelProvider) Returns an unmodifiable view of the content-node-map.Returns theIViewer
that displays the contents.javafx.embed.swt.FXCanvas
Returns theILayoutAlgorithm
that is used for laying out the contents.protected SelectionModel
Retrieves theSelectionModel
used by the viewer (getContentViewer()
)protected void
handleDispose
(DisposeEvent event) protected void
inputChanged
(Object input, Object oldInput) void
refresh()
void
setLayoutAlgorithm
(ILayoutAlgorithm layoutAlgorithm) Changes theILayoutAlgorithm
that is used for laying out the contents to the given value.void
setSelection
(ISelection selection, boolean reveal) protected String
Converts the givenColor
into a CSS string:"rgb(red,green,blue)"
.Methods inherited from class org.eclipse.jface.viewers.ContentViewer
getContentProvider, getInput, handleLabelProviderChanged, hookControl, labelProviderChanged, setContentProvider, setInput, setLabelProvider
Methods 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 anFXCanvas
inside of the given parentComposite
. TheFXCanvas
serves acs the container for the JavaFXScene
which renders the contents.- Parameters:
parent
- The parentComposite
.style
- The SWT style bits to be used for the to be created canvas.- Returns:
- An
FXCanvas
inside of the given parent.
-
createControl
Creates the control for thisZestContentViewer
inside of the given parentComposite
.- Parameters:
parent
- The parentComposite
.style
- The SWT style for thisZestContentViewer
, which will be forwarded to itsFXCanvas
control.
-
createEdge
protected Edge createEdge(ILabelProvider labelProvider, Object contentSourceNode, Node sourceNode, Object contentTargetNode, Node targetNode) Constructs and returns a newEdge
connecting 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'sILabelProvider
for convenience.contentSourceNode
- The content element representing the source node of this edge.sourceNode
- The already created sourceNode
of this edge.contentTargetNode
- The content element representing the target node of this edge.targetNode
- The already created targetNode
of this edge.- Returns:
- The new
Edge
.
-
createEmptyGraph
Constructs and returns a newGraph
and inserts default attributes into it:- layout algorithm
- Returns:
- A new
Graph
with default attributes.
-
createNestedGraph
protected Graph createNestedGraph(Object contentNestingNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider) Creates aGraph
nested in the node represented by the given contentNestingNode.- Parameters:
contentNestingNode
- The contentObject
that represents the nesting node.graphContentProvider
- This viewer'sIGraphContentProvider
for convenience.labelProvider
- This viewer'sILabelProvider
for convenience.- Returns:
- The new
Graph
.
-
createNode
protected Node createNode(Object contentNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider) Creates aNode
for the specified contentNode using theIContentProvider
andILabelProvider
. Moreover, the new node is put into the given contentToGraphMap.- Parameters:
contentNode
- The contentObject
that represents the node.graphContentProvider
- This viewer'sIGraphContentProvider
for convenience.labelProvider
- This viewer'sILabelProvider
for convenience.- Returns:
- The new
Node
.
-
createNodesAndEdges
protected void createNodesAndEdges(IGraphContentProvider graphContentProvider, ILabelProvider labelProvider, Graph graph, Object[] contentNodes) - Parameters:
graphContentProvider
- This viewer'sIGraphContentProvider
for convenience.labelProvider
- This viewer'sILabelProvider
for convenience.graph
- TheGraph
for 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
- TheIContentProvider
for this viewer.labelProvider
- TheILabelProvider
for this viewer.- Returns:
- A complete
Graph
constructed 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 theIViewer
that displays the contents.- Returns:
- The
IViewer
that displays the contents.
-
getControl
public javafx.embed.swt.FXCanvas getControl()- Specified by:
getControl
in classViewer
-
getLabelProvider
- Overrides:
getLabelProvider
in classContentViewer
-
getLayoutAlgorithm
Returns theILayoutAlgorithm
that is used for laying out the contents.- Returns:
- The
ILayoutAlgorithm
that is used for laying out the contents.
-
getSelection
- Specified by:
getSelection
in interfaceISelectionProvider
- Specified by:
getSelection
in classViewer
-
getSelectionModel
Retrieves theSelectionModel
used by the viewer (getContentViewer()
)- Returns:
- The
SelectionModel
adapted to the viewer (getContentViewer()
).
-
handleDispose
- Overrides:
handleDispose
in classContentViewer
-
inputChanged
- Overrides:
inputChanged
in classViewer
-
refresh
public void refresh() -
setLayoutAlgorithm
Changes theILayoutAlgorithm
that is used for laying out the contents to the given value.- Parameters:
layoutAlgorithm
- The newILayoutAlgorithm
to use.
-
setSelection
- Specified by:
setSelection
in classViewer
-
toCssRgb
Converts the givenColor
into a CSS string:"rgb(red,green,blue)"
.- Parameters:
color
- TheColor
to convert.- Returns:
- The corresponding CSS string.
-