Package org.eclipse.zest.core.viewers
Class GraphViewer
- All Implemented Interfaces:
IInputProvider
,IInputSelectionProvider
,IPostSelectionProvider
,ISelectionProvider
This view is used to represent a static graph. Static graphs can be layed
out, but do not continually update their layout locations.
- @noextend
- This class is not intended to be subclassed by clients.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.viewers.StructuredViewer
StructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders
-
Field Summary
FieldsFields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEY
-
Constructor Summary
ConstructorsConstructorDescriptionGraphViewer
(Composite composite, int style) Initializes the viewer.GraphViewer
(Graph graph) Initializes the viewer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Applys the current layout to the viewerfindGraphItem
(Object element) Finds the graph widget item for a given user model item.Object[]
protected org.eclipse.zest.core.viewers.internal.IStylingGraphModelFactory
Returns the factory used to create the model.protected LayoutAlgorithm
Gets the current layout algorithm.Object[]
int
getStyle()
Gets the styles for this structuredViewerprotected org.eclipse.zest.core.viewers.internal.ZoomManager
Returns a ZoomManager that zooming can be done on.protected void
hookControl
(Control control) protected void
inputChanged
(Object input, Object oldInput) void
NOTE: If a layout algorithm is set in the receiver, layout is performed after the refresh.void
NOTE: If a layout algorithm is set in the receiver, layout is performed after the refresh.void
void
void
setConnectionStyle
(int connectionStyle) Sets the default style for connections in this graph.void
setContentProvider
(IContentProvider contentProvider) void
setControl
(Graph graphModel) void
setLayoutAlgorithm
(LayoutAlgorithm algorithm) Equivalent to setLayoutAlgorithm(algorithm, false).void
setLayoutAlgorithm
(LayoutAlgorithm algorithm, boolean runLayout) Sets the layout algorithm to use for this viewer.void
setNodeStyle
(int nodeStyle) Sets the default style for nodes in this graph.protected void
setSelectionToWidget
(List l, boolean reveal) void
void
NOTE: If a layout algorithm is set in the receiver, layout is performed after the update.void
NOTE: If a layout algorithm is set in the receiver, layout is performed after the update.Methods inherited from class org.eclipse.zest.core.viewers.AbstractStructuredGraphViewer
addConstraintAdapter, addGraphModelConnection, addGraphModelContainer, addGraphModelNode, addGraphModelNode, addNode, addRelationship, addRelationship, createConnectionObject, createNodeObject, doFindInputItem, doFindItem, doUpdateItem, filterVisuals, findItems, getConnectionsArray, getConnectionStyle, getConstraintAdapters, getGraphModelConnection, getGraphModelNode, getGraphStyle, getNodesArray, getNodesMap, getNodeStyle, getRawChildren, getSelectionFromWidget, getWidgetSelection, internalRefresh, removeGraphModelConnection, removeGraphModelNode, removeNode, removeRelationship
Methods inherited from class org.eclipse.zest.core.viewers.AbstractZoomableViewer
zoomTo
Methods inherited from class org.eclipse.jface.viewers.StructuredViewer
addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertContentProviderType, assertElementsNotNull, associate, buildLabel, disassociate, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, firePostSelectionChanged, getColorAndFontCollector, getComparator, getComparer, getFilteredChildren, getFilters, getItem, getRoot, getSelection, getSortedChildren, getSorter, getStructuredSelection, handleDispose, handleDoubleSelect, handleInvalidSelection, handleLabelProviderChanged, handleOpen, handlePostSelect, handleSelect, hasFilters, internalRefresh, internalUpdate, mapElement, needsRefilter, preservingSelection, refresh, refresh, refreshItem, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparator, setComparer, setFilters, setInput, setLabelProvider, setSelection, setSelectionToWidget, setSorter, setUseHashlookup, testFindItem, testFindItems, unmapAllElements, unmapElement, unmapElement, updateItem, updateSelection, usingElementMap
Methods inherited from class org.eclipse.jface.viewers.ContentViewer
getContentProvider, getInput, getLabelProvider, labelProviderChanged
Methods inherited from class org.eclipse.jface.viewers.Viewer
addHelpListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, scrollDown, scrollUp, setData, setSelection
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
getSelection, setSelection
-
Field Details
-
graph
-
-
Constructor Details
-
GraphViewer
Initializes the viewer.- Parameters:
composite
- The parent composite.style
- The style for the viewer and the related Graph.- See Also:
-
GraphViewer
Initializes the viewer.- Parameters:
graph
- The initial graph widget- Since:
- 1.14
-
-
Method Details
-
setControl
-
hookControl
- Overrides:
hookControl
in classStructuredViewer
-
inputChanged
- Overrides:
inputChanged
in classAbstractStructuredGraphViewer
-
getStyle
public int getStyle()Gets the styles for this structuredViewer -
getGraphControl
- Overrides:
getGraphControl
in classAbstractStructuredGraphViewer
-
setLayoutAlgorithm
Sets the layout algorithm to use for this viewer.- Specified by:
setLayoutAlgorithm
in classAbstractStructuredGraphViewer
- Parameters:
algorithm
- the algorithm to layout the nodesrunLayout
- if the layout should be run
-
setLayoutAlgorithm
Description copied from class:AbstractStructuredGraphViewer
Equivalent to setLayoutAlgorithm(algorithm, false).- Overrides:
setLayoutAlgorithm
in classAbstractStructuredGraphViewer
- Parameters:
algorithm
-
-
setNodeStyle
public void setNodeStyle(int nodeStyle) Description copied from class:AbstractStructuredGraphViewer
Sets the default style for nodes in this graph. Note: if an input is set on the viewer, a ZestException will be thrown.- Overrides:
setNodeStyle
in classAbstractStructuredGraphViewer
- Parameters:
nodeStyle
- the style for the nodes.- See Also:
-
setContentProvider
- Overrides:
setContentProvider
in classStructuredViewer
-
findGraphItem
Finds the graph widget item for a given user model item. Note: This method returns an internal interface (GraphItem). You should be able to cast this to either a IGraphModelNode or IGraphModelConnection (which are also internal). These are internal because this API is not stable. If use this method (to access internal nodes and edges), your code may not compile between versions.- Parameters:
element
- The user model node.- Returns:
- An IGraphItem. This should be either a IGraphModelNode or IGraphModelConnection
-
applyLayout
public void applyLayout()Applys the current layout to the viewer- Specified by:
applyLayout
in classAbstractStructuredGraphViewer
-
setSelectionToWidget
- Overrides:
setSelectionToWidget
in classAbstractStructuredGraphViewer
-
getControl
- Specified by:
getControl
in classViewer
-
getNodeElements
- Overrides:
getNodeElements
in classAbstractStructuredGraphViewer
-
getConnectionElements
- Overrides:
getConnectionElements
in classAbstractStructuredGraphViewer
-
reveal
- Overrides:
reveal
in classAbstractStructuredGraphViewer
-
setConnectionStyle
public void setConnectionStyle(int connectionStyle) Description copied from class:AbstractStructuredGraphViewer
Sets the default style for connections in this graph. Note: if an input is set on the viewer, a ZestException will be thrown.- Overrides:
setConnectionStyle
in classAbstractStructuredGraphViewer
- Parameters:
connectionStyle
- the style for the connections.- See Also:
-
unReveal
- Overrides:
unReveal
in classAbstractStructuredGraphViewer
-
addSelectionChangedListener
- Specified by:
addSelectionChangedListener
in interfaceISelectionProvider
- Overrides:
addSelectionChangedListener
in classViewer
-
removeSelectionChangedListener
- Specified by:
removeSelectionChangedListener
in interfaceISelectionProvider
- Overrides:
removeSelectionChangedListener
in classViewer
-
refresh
NOTE: If a layout algorithm is set in the receiver, layout is performed after the refresh.- Overrides:
refresh
in classStructuredViewer
-
refresh
NOTE: If a layout algorithm is set in the receiver, layout is performed after the refresh.- Overrides:
refresh
in classStructuredViewer
-
update
NOTE: If a layout algorithm is set in the receiver, layout is performed after the update.- Overrides:
update
in classStructuredViewer
-
update
NOTE: If a layout algorithm is set in the receiver, layout is performed after the update.- Overrides:
update
in classStructuredViewer
-
getZoomManager
protected org.eclipse.zest.core.viewers.internal.ZoomManager getZoomManager()Description copied from class:AbstractZoomableViewer
Returns a ZoomManager that zooming can be done on. May return null if none is available.- Specified by:
getZoomManager
in classAbstractZoomableViewer
- Returns:
- a ZoomManager that zooming can be done on.
-
getFactory
protected org.eclipse.zest.core.viewers.internal.IStylingGraphModelFactory getFactory()Description copied from class:AbstractStructuredGraphViewer
Returns the factory used to create the model. This must not be called before the content provider is set.- Specified by:
getFactory
in classAbstractStructuredGraphViewer
-
getLayoutAlgorithm
Description copied from class:AbstractStructuredGraphViewer
Gets the current layout algorithm.- Specified by:
getLayoutAlgorithm
in classAbstractStructuredGraphViewer
- Returns:
- the current layout algorithm.
-