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
public class ZestContentViewer extends ContentViewer
-
-
Field Summary
-
Fields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEY
-
-
Constructor Summary
Constructors Constructor Description ZestContentViewer(Module module)Constructs a newZestContentViewer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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, java.lang.Object contentSourceNode, Node sourceNode, java.lang.Object contentTargetNode, Node targetNode)Constructs and returns a newEdgeconnecting the given sourceNode and targetNode.protected GraphcreateEmptyGraph()Constructs and returns a newGraphand inserts default attributes into it: layout algorithmprotected GraphcreateNestedGraph(java.lang.Object contentNestingNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider)Creates aGraphnested in the node represented by the given contentNestingNode.protected NodecreateNode(java.lang.Object contentNode, IGraphContentProvider graphContentProvider, ILabelProvider labelProvider)protected voidcreateNodesAndEdges(IGraphContentProvider graphContentProvider, ILabelProvider labelProvider, Graph graph, java.lang.Object[] contentNodes)protected GraphcreateRootGraph(IContentProvider contentProvider, ILabelProvider labelProvider)java.util.Map<java.lang.Object,Node>getContentNodeMap()Returns an unmodifiable view of the content-node-map.IViewergetContentViewer()Returns theIViewerthat displays the contents.javafx.embed.swt.FXCanvasgetControl()ILabelProvidergetLabelProvider()ILayoutAlgorithmgetLayoutAlgorithm()Returns theILayoutAlgorithmthat is used for laying out the contents.ISelectiongetSelection()protected SelectionModelgetSelectionModel()Retrieves theSelectionModelused by the viewer (getContentViewer())protected voidhandleDispose(DisposeEvent event)protected voidinputChanged(java.lang.Object input, java.lang.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 java.lang.StringtoCssRgb(Color color)Converts 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, setLabelProvider
-
Methods inherited from class org.eclipse.jface.viewers.Viewer
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection
-
-
-
-
Constructor Detail
-
ZestContentViewer
public ZestContentViewer(Module module)
Constructs a newZestContentViewer. The givenModuleis saved so that it can be later used to create anInjectorthat is later used for the injection of members and the construction of theIDomain.
-
-
Method Detail
-
createCanvas
protected javafx.embed.swt.FXCanvas createCanvas(Composite parent, int style)
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
public void createControl(Composite parent, int style)
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, java.lang.Object contentSourceNode, Node sourceNode, java.lang.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
protected Graph createEmptyGraph()
Constructs and returns a newGraphand inserts default attributes into it:- layout algorithm
- Returns:
- A new
Graphwith default attributes.
-
createNestedGraph
protected Graph createNestedGraph(java.lang.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(java.lang.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, java.lang.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
protected Graph createRootGraph(IContentProvider contentProvider, ILabelProvider labelProvider)
- Parameters:
contentProvider- TheIContentProviderfor this viewer.labelProvider- TheILabelProviderfor this viewer.- Returns:
- A complete
Graphconstructed by using the given providers.
-
getContentNodeMap
public java.util.Map<java.lang.Object,Node> getContentNodeMap()
Returns an unmodifiable view of the content-node-map.- Returns:
- An unmodifiable view of the content-node-map.
-
getContentViewer
public IViewer getContentViewer()
Returns theIViewerthat displays the contents.- Returns:
- The
IViewerthat displays the contents.
-
getControl
public javafx.embed.swt.FXCanvas getControl()
- Specified by:
getControlin classViewer
-
getLabelProvider
public ILabelProvider getLabelProvider()
- Overrides:
getLabelProviderin classContentViewer
-
getLayoutAlgorithm
public ILayoutAlgorithm getLayoutAlgorithm()
Returns theILayoutAlgorithmthat is used for laying out the contents.- Returns:
- The
ILayoutAlgorithmthat is used for laying out the contents.
-
getSelection
public ISelection getSelection()
- Specified by:
getSelectionin interfaceISelectionProvider- Specified by:
getSelectionin classViewer
-
getSelectionModel
protected SelectionModel getSelectionModel()
Retrieves theSelectionModelused by the viewer (getContentViewer())- Returns:
- The
SelectionModeladapted to the viewer (getContentViewer()).
-
handleDispose
protected void handleDispose(DisposeEvent event)
- Overrides:
handleDisposein classContentViewer
-
inputChanged
protected void inputChanged(java.lang.Object input, java.lang.Object oldInput)- Overrides:
inputChangedin classViewer
-
setLayoutAlgorithm
public void setLayoutAlgorithm(ILayoutAlgorithm layoutAlgorithm)
Changes theILayoutAlgorithmthat is used for laying out the contents to the given value.- Parameters:
layoutAlgorithm- The newILayoutAlgorithmto use.
-
setSelection
public void setSelection(ISelection selection, boolean reveal)
- Specified by:
setSelectionin classViewer
-
-