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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intprotected List<GraphConnection> static final intFields inherited from class org.eclipse.draw2d.FigureCanvas
ALWAYS, AUTOMATIC, NEVER -
Constructor Summary
Constructors -
Method Summary
Modifier 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.FigureCanvas
computeSize, getContents, getFont, getHorizontalScrollBarVisibility, getLightweightSystem, getVerticalScrollBarVisibility, getViewport, scrollSmoothTo, scrollTo, scrollToX, scrollToY, setBorder, setContents, setFont, setHorizontalScrollBarVisibility, setScrollBarVisibility, setVerticalScrollBarVisibility, setViewportMethods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setIMEMethods inherited from class org.eclipse.swt.widgets.Composite
changed, 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.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods inherited from class org.eclipse.swt.widgets.Control
addControlListener, 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.Widget
addDisposeListener, 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.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Field Details
-
ANIMATION_TIME
public static final int ANIMATION_TIME- See Also:
-
FISHEYE_ANIMATION_TIME
public 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
-
Graph
Constructor 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 underlyingFigureCanvas. SeeFigureCanvas.ACCEPTED_STYLESfor a list of all supported styles. UsesetGraphStyle(int)to set the Zest-specific styles.
-
Graph
Constructor 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 underlyingFigureCanvas. SeeFigureCanvas.ACCEPTED_STYLESfor a list of all supported styles. UsesetGraphStyle(int)to set the Zest-specific styles.enableHideNodes-- Since:
- 1.8
-
-
Method Details
-
addSelectionListener
This adds a listener to the set of listeners that will be called when a selection event occurs.- Parameters:
selectionListener-
-
removeSelectionListener
-
getNodes
Gets 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 interfaceIContainer- 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-
-
getRootLayer
Gets the root layer for this graph -
setConnectionStyle
public void setConnectionStyle(int connectionStyle) Sets the default connection style.- Parameters:
connectionStyle- style the connection style to set- See Also:
-
getConnectionStyle
public int getConnectionStyle()Gets the default connection style.- Returns:
- the connection style
- See Also:
-
setNodeStyle
public void setNodeStyle(int nodeStyle) Sets the default node style.- Parameters:
nodeStyle- the node style to set- See Also:
-
getNodeStyle
public int getNodeStyle()Gets the default node style.- Returns:
- the node style
- See Also:
-
setGraphStyle
public final void setGraphStyle(int style) Sets the default graph style.- Parameters:
style- the graph style to set.- Since:
- 1.15
- See Also:
-
getGraphStyle
public final int getGraphStyle()Gets the default graph style.- Returns:
- the default graph style
- Since:
- 1.15
-
getConnections
Gets the list of GraphModelConnection objects.- Specified by:
getConnectionsin interfaceIContainer2- Returns:
- list of GraphModelConnection objects
-
setSelection
Changes the selection to the list of items- Parameters:
items-
-
selectAll
public void selectAll() -
getSelection
Gets the list of currently selected graph items- Returns:
- Currently selected graph items
-
toString
-
getGraphModel
Deprecated, for removal: This API element is subject to removal in a future version. -
dispose
public void dispose()Dispose of the nodes and edges when the graph is disposed. -
applyLayout
public 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 interfaceIContainer
-
applyLayoutNow
public void applyLayoutNow()Apply this graphs's layout cleanly and display all changes.- Since:
- 1.14
-
setDynamicLayout
public 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
-
isDynamicLayoutEnabled
public boolean isDynamicLayoutEnabled()- Returns:
- true if dynamic layout is enabled (see
setDynamicLayout(boolean)) - Since:
- 1.14
-
setPreferredSize
public 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 interfaceIContainer2- @noreference
- This method is not intended to be referenced by clients.
-
setLayoutAlgorithm
Description copied from interface:IContainerSets the LayoutAlgorithm for this container and optionally applies it.- Specified by:
setLayoutAlgorithmin interfaceIContainer- Parameters:
algorithm-applyLayout-
-
setSubgraphFactory
- Since:
- 1.14
-
getSubgraphFactory
- Since:
- 1.14
-
setExpandCollapseManager
- Since:
- 1.14
-
getExpandCollapseManager
- Since:
- 1.14
-
addLayoutFilter
Adds 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
-
removeLayoutFilter
Removes given layout filter. If it had not been added to this graph, this method does nothing.- Parameters:
filter- filter to remove- Since:
- 1.14
-
getFigureAt
Finds a figure at the location X, Y in the graph This point should be translated to relative before calling findFigureAt -
getHideNodesEnabled
public boolean getHideNodesEnabled()- Since:
- 1.8
-
createGraphDragSupport
Creator method for DragSupport- Returns:
- class that implemented GraphDragSupport
- Since:
- 1.9
-
notifyListeners
- Overrides:
notifyListenersin classWidget
-
clear
public void clear()Clear the graph of all its content.- Since:
- 1.14
-
addNode
- Specified by:
addNodein interfaceIContainer2- Parameters:
node-- @noreference
- This method is not intended to be referenced by clients.
-
addSubgraphFigure
- Specified by:
addSubgraphFigurein interfaceIContainer2- Parameters:
figure-- @noreference
- This method is not intended to be referenced by clients.
-
createLayers
Layer creation- Returns:
- IFigure the rootlayer
- Since:
- 1.9
-
createZestRootLayer
protected org.eclipse.zest.core.widgets.internal.ZestRootLayer createZestRootLayer()Creator method for ZestRootLayer- Returns:
- new ZestRootLayer instance
- Since:
- 1.9
-
getGraph
- Specified by:
getGraphin interfaceIContainer
-
addFisheyeListener
Adds 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
-
getItemType
public int getItemType()- Specified by:
getItemTypein interfaceIContainer
-
getGraphItem
Returns 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 interfaceIContainer2- Since:
- 1.12
-
getLayoutBounds
- Specified by:
getLayoutBoundsin interfaceIContainer2- Since:
- 1.12
-
setRouter
Updates the connection router and applies to to all existing connections that have no connection routers set to them.- Parameters:
connectionRouter-- Since:
- 1.14
-
getZoomManager
public 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
-