Package org.eclipse.zest.core.widgets
Class Graph
- All Implemented Interfaces:
- Drawable,- IContainer,- IContainer2
Holds the nodes and connections for the graph.
- Since:
- 1.0
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intprotected List<GraphConnection> static final intFields inherited from class org.eclipse.draw2d.FigureCanvasALWAYS, AUTOMATIC, NEVER
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddConstraintAdapter(ConstraintAdapter constraintAdapter) Deprecated, for removal: This API element is subject to removal in a future version.No longer used in Zest 2.x.voidaddFisheyeListener(FisheyeListener listener) Adds a listener that will be notified when fisheyed figures change in this graph.voidaddLayoutFilter(LayoutFilter filter) Adds a filter used for hiding elements from layout algorithm.voidvoidaddSelectionListener(SelectionListener selectionListener) This adds a listener to the set of listeners that will be called when a selection event occurs.voidaddSubgraphFigure(IFigure figure) voidRuns the layout on this graph.voidApply this graphs's layout cleanly and display all changes.booleancanCollapse(GraphNode node) booleanvoidclear()Clear the graph of all its content.protected GraphDragSupportCreator method for DragSupportprotected IFigureLayer creationprotected org.eclipse.zest.core.widgets.internal.ZestRootLayerCreator method for ZestRootLayervoiddispose()Dispose of the nodes and edges when the graph is disposed.List<? extends GraphConnection> Gets the list of GraphModelConnection objects.intGets the default connection style.getFigureAt(int x, int y) Finds a figure at the location X, Y in the graph This point should be translated to relative before calling findFigureAtgetGraph()protected GraphItemgetGraphItem(IFigure figure) Returns the item for the given figureDeprecated, for removal: This API element is subject to removal in a future version.final intGets the default graph style.booleangetItem()intfinal LayoutContextgetNodes()Gets a list of the GraphModelNode children objects under the root node in this diagram.intGets the default node style.Gets the root layer for this graphGets the list of currently selected graph itemsorg.eclipse.zest.core.viewers.internal.ZoomManagerReturns the ZoomManager component used for scaling the graph widget.booleanvoidnotifyListeners(int eventType, Event event) voidremoveFisheyeListener(FisheyeListener listener) voidremoveLayoutFilter(LayoutFilter filter) Removes given layout filter.voidremoveSelectionListener(SelectionListener selectionListener) voidvoidsetConnectionStyle(int connectionStyle) Sets the default connection style.voidsetConstraintAdapters(List<ConstraintAdapter> constraintAdapters) Deprecated, for removal: This API element is subject to removal in a future version.No longer used in Zest 2.x.voidsetDynamicLayout(boolean enabled) Enables or disables dynamic layout (that is layout algorithm performing layout in background or when certain events occur).voidsetExpandCollapseManager(ExpandCollapseManager expandCollapseManager) voidsetExpanded(GraphNode node, boolean expanded) final voidsetGraphStyle(int style) Sets the default graph style.voidsetLayoutAlgorithm(LayoutAlgorithm algorithm, boolean applyLayout) Sets the LayoutAlgorithm for this container and optionally applies it.voidsetNodeStyle(int nodeStyle) Sets the default node style.voidsetPreferredSize(int width, int height) Sets the preferred size of the layout area.voidsetRouter(ConnectionRouter connectionRouter) Updates the connection router and applies to to all existing connections that have no connection routers set to them.voidsetSelection(GraphItem[] items) Changes the selection to the list of itemsvoidsetSubgraphFactory(SubgraphFactory factory) toString()Methods inherited from class org.eclipse.draw2d.FigureCanvascomputeSize, getContents, getFont, getHorizontalScrollBarVisibility, getLightweightSystem, getVerticalScrollBarVisibility, getViewport, scrollSmoothTo, scrollTo, scrollToX, scrollToY, setBorder, setContents, setFont, setHorizontalScrollBarVisibility, setScrollBarVisibility, setVerticalScrollBarVisibility, setViewportMethods inherited from class org.eclipse.swt.widgets.CanvasdrawBackground, getCaret, getIME, scroll, setCaret, setIMEMethods inherited from class org.eclipse.swt.widgets.Compositechanged, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabListMethods inherited from class org.eclipse.swt.widgets.ScrollablecomputeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods inherited from class org.eclipse.swt.widgets.ControladdControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.WidgetaddDisposeListener, addListener, addTypedListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setDataMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.DrawableisAutoScalable
- 
Field Details- 
ANIMATION_TIMEpublic static final int ANIMATION_TIME- See Also:
 
- 
FISHEYE_ANIMATION_TIMEpublic static final int FISHEYE_ANIMATION_TIME- See Also:
 
- 
LIGHT_BLUE
- 
LIGHT_BLUE_CYAN
- 
GREY_BLUE
- 
DARK_BLUE
- 
LIGHT_YELLOW
- 
HIGHLIGHT_COLOR
- 
HIGHLIGHT_ADJACENT_COLOR
- 
DEFAULT_NODE_COLOR
- 
connections
 
- 
- 
Constructor Details- 
GraphConstructor for a Graph. This widget represents the root of the graph, and can contain graph items such as graph nodes and graph connections.- Parameters:
- parent-
- style- The SWT style used for the underlying- FigureCanvas. See- FigureCanvas.ACCEPTED_STYLESfor a list of all supported styles. Use- setGraphStyle(int)to set the Zest-specific styles.
 
- 
GraphConstructor for a Graph. This widget represents the root of the graph, and can contain graph items such as graph nodes and graph connections.- Parameters:
- parent-
- style- The SWT style used for the underlying- FigureCanvas. See- FigureCanvas.ACCEPTED_STYLESfor a list of all supported styles. Use- setGraphStyle(int)to set the Zest-specific styles.
- enableHideNodes-
- Since:
- 1.8
 
 
- 
- 
Method Details- 
addSelectionListenerThis adds a listener to the set of listeners that will be called when a selection event occurs.- Parameters:
- selectionListener-
 
- 
removeSelectionListener
- 
getNodesGets a list of the GraphModelNode children objects under the root node in this diagram. If the root node is null then all the top level nodes are returned.- Specified by:
- getNodesin interface- IContainer
- Returns:
- List of GraphModelNode objects
 
- 
addConstraintAdapter@Deprecated(since="2.0", forRemoval=true) public void addConstraintAdapter(ConstraintAdapter constraintAdapter) Deprecated, for removal: This API element is subject to removal in a future version.No longer used in Zest 2.x. This class will be removed in a future release in accordance with the two year deprecation policy.Adds a new constraint adapter to the list of constraint adapters- Parameters:
- constraintAdapter-
 
- 
setConstraintAdapters@Deprecated(since="2.0", forRemoval=true) public void setConstraintAdapters(List<ConstraintAdapter> constraintAdapters) Deprecated, for removal: This API element is subject to removal in a future version.No longer used in Zest 2.x. This class will be removed in a future release in accordance with the two year deprecation policy.Sets the constraint adapters on this model- Parameters:
- constraintAdapters-
 
- 
getRootLayerGets the root layer for this graph
- 
setConnectionStylepublic void setConnectionStyle(int connectionStyle) Sets the default connection style.- Parameters:
- connectionStyle- style the connection style to set
- See Also:
 
- 
getConnectionStylepublic int getConnectionStyle()Gets the default connection style.- Returns:
- the connection style
- See Also:
 
- 
setNodeStylepublic void setNodeStyle(int nodeStyle) Sets the default node style.- Parameters:
- nodeStyle- the node style to set
- See Also:
 
- 
getNodeStylepublic int getNodeStyle()Gets the default node style.- Returns:
- the node style
- See Also:
 
- 
setGraphStylepublic final void setGraphStyle(int style) Sets the default graph style.- Parameters:
- style- the graph style to set.
- Since:
- 1.15
- See Also:
 
- 
getGraphStylepublic final int getGraphStyle()Gets the default graph style.- Returns:
- the default graph style
- Since:
- 1.15
 
- 
getConnectionsGets the list of GraphModelConnection objects.- Specified by:
- getConnectionsin interface- IContainer2
- Returns:
- list of GraphModelConnection objects
 
- 
setSelectionChanges the selection to the list of items- Parameters:
- items-
 
- 
selectAllpublic void selectAll()
- 
getSelectionGets the list of currently selected graph items- Returns:
- Currently selected graph items
 
- 
toString
- 
getGraphModelDeprecated, for removal: This API element is subject to removal in a future version.
- 
disposepublic void dispose()Dispose of the nodes and edges when the graph is disposed.
- 
applyLayoutpublic void applyLayout()Runs the layout on this graph. If the view is not visible layout will be deferred until after the view is available.- Specified by:
- applyLayoutin interface- IContainer
 
- 
applyLayoutNowpublic void applyLayoutNow()Apply this graphs's layout cleanly and display all changes.- Since:
- 1.14
 
- 
setDynamicLayoutpublic void setDynamicLayout(boolean enabled) Enables or disables dynamic layout (that is layout algorithm performing layout in background or when certain events occur). Dynamic layout should be disabled before doing a long series of changes in the graph to make sure that layout algorithm won't interfere with these changes. Enabling dynamic layout causes the layout algorithm to be applied even if it's not actually a dynamic algorithm.- Parameters:
- enabled-
- Since:
- 1.14
 
- 
isDynamicLayoutEnabledpublic boolean isDynamicLayoutEnabled()- Returns:
- true if dynamic layout is enabled (see
         setDynamicLayout(boolean))
- Since:
- 1.14
 
- 
setPreferredSizepublic void setPreferredSize(int width, int height) Sets the preferred size of the layout area. Size of ( -1, -1) uses the current canvas size.- Parameters:
- width-
- height-
 
- 
getPreferredSize- Returns:
- the preferred size of the layout area.
- Since:
- 1.14
 
- 
getLayoutContext- Specified by:
- getLayoutContextin interface- IContainer2
- @noreference
- This method is not intended to be referenced by clients.
 
- 
setLayoutAlgorithmDescription copied from interface:IContainerSets the LayoutAlgorithm for this container and optionally applies it.- Specified by:
- setLayoutAlgorithmin interface- IContainer
- Parameters:
- algorithm-
- applyLayout-
 
- 
setSubgraphFactory- Since:
- 1.14
 
- 
getSubgraphFactory- Since:
- 1.14
 
- 
setExpandCollapseManager- Since:
- 1.14
 
- 
getExpandCollapseManager- Since:
- 1.14
 
- 
addLayoutFilterAdds a filter used for hiding elements from layout algorithm. NOTE: If a node or subgraph if filtered out, all connections adjacent to it should also be filtered out. Otherwise layout algorithm may behave in an unexpected way.- Parameters:
- filter- filter to add
- Since:
- 1.14
 
- 
getLayoutAlgorithm
- 
removeLayoutFilterRemoves given layout filter. If it had not been added to this graph, this method does nothing.- Parameters:
- filter- filter to remove
- Since:
- 1.14
 
- 
getFigureAtFinds a figure at the location X, Y in the graph This point should be translated to relative before calling findFigureAt
- 
getHideNodesEnabledpublic boolean getHideNodesEnabled()- Since:
- 1.8
 
- 
createGraphDragSupportCreator method for DragSupport- Returns:
- class that implemented GraphDragSupport
- Since:
- 1.9
 
- 
notifyListeners- Overrides:
- notifyListenersin class- Widget
 
- 
clearpublic void clear()Clear the graph of all its content.- Since:
- 1.14
 
- 
addNode- Specified by:
- addNodein interface- IContainer2
- Parameters:
- node-
- @noreference
- This method is not intended to be referenced by clients.
 
- 
addSubgraphFigure- Specified by:
- addSubgraphFigurein interface- IContainer2
- Parameters:
- figure-
- @noreference
- This method is not intended to be referenced by clients.
 
- 
createLayersLayer creation- Returns:
- IFigure the rootlayer
- Since:
- 1.9
 
- 
createZestRootLayerprotected org.eclipse.zest.core.widgets.internal.ZestRootLayer createZestRootLayer()Creator method for ZestRootLayer- Returns:
- new ZestRootLayer instance
- Since:
- 1.9
 
- 
getGraph- Specified by:
- getGraphin interface- IContainer
 
- 
addFisheyeListenerAdds a listener that will be notified when fisheyed figures change in this graph.- Parameters:
- listener- listener to add
- Since:
- 1.14
 
- 
removeFisheyeListener- Since:
- 1.14
 
- 
getItemTypepublic int getItemType()- Specified by:
- getItemTypein interface- IContainer
 
- 
getGraphItemReturns the item for the given figure- Parameters:
- figure-
- Returns:
- GraphItem for the given IFigure
- Since:
- 1.9
 
- 
setExpanded- Since:
- 1.14
 
- 
canExpand- Since:
- 1.14
 
- 
canCollapse- Since:
- 1.14
 
- 
getItem- Specified by:
- getItemin interface- IContainer2
- Since:
- 1.12
 
- 
getLayoutBounds- Specified by:
- getLayoutBoundsin interface- IContainer2
- Since:
- 1.12
 
- 
setRouterUpdates the connection router and applies to to all existing connections that have no connection routers set to them.- Parameters:
- connectionRouter-
- Since:
- 1.14
 
- 
getZoomManagerpublic org.eclipse.zest.core.viewers.internal.ZoomManager getZoomManager()Returns the ZoomManager component used for scaling the graph widget.- Returns:
- the ZoomManager component
- Since:
- 1.14
 
 
-