public class GraphViewer extends AbstractStructuredGraphViewer implements ISelectionProvider
StructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders
Modifier and Type | Field and Description |
---|---|
protected GraphWidget |
graph |
WIDGET_DATA_KEY
Constructor and Description |
---|
GraphViewer(Composite composite,
int style)
Initializes the viewer.
|
GraphViewer(GraphWidget graph)
Initializes the viewer.
|
Modifier and Type | Method and Description |
---|---|
void |
addSelectionChangedListener(ISelectionChangedListener listener) |
void |
applyLayout()
Applys the current layout to the viewer
|
GraphItem |
findGraphItem(java.lang.Object element)
Finds the graph widget item for a given user model item.
|
java.lang.Object[] |
getConnectionElements() |
Control |
getControl() |
protected org.eclipse.gef4.zest.core.viewers.internal.IStylingGraphModelFactory |
getFactory()
(non-Javadoc)
|
GraphWidget |
getGraphControl() |
protected org.eclipse.gef4.layout.LayoutAlgorithm |
getLayoutAlgorithm()
Gets the current layout algorithm.
|
java.lang.Object[] |
getNodeElements() |
int |
getStyle()
Gets the styles for this structuredViewer
|
protected ZoomManager |
getZoomManager()
Returns a ZoomManager that zooming can be done on.
|
protected void |
hookControl(Control control) |
protected void |
inputChanged(java.lang.Object input,
java.lang.Object oldInput) |
void |
refresh(java.lang.Object element) |
void |
refresh(java.lang.Object element,
boolean updateLabels) |
void |
removeSelectionChangedListener(ISelectionChangedListener listener) |
void |
reveal(java.lang.Object element) |
void |
setConnectionStyle(int connectionStyle)
Sets the default style for connections in this graph.
|
void |
setContentProvider(IContentProvider contentProvider) |
void |
setLayoutAlgorithm(org.eclipse.gef4.layout.LayoutAlgorithm algorithm)
Equivalent to setLayoutAlgorithm(algorithm, false).
|
void |
setLayoutAlgorithm(org.eclipse.gef4.layout.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(java.util.List l,
boolean reveal) |
void |
unReveal(java.lang.Object element) |
void |
update(java.lang.Object[] elements,
java.lang.String[] properties) |
void |
update(java.lang.Object element,
java.lang.String[] properties) |
addGraphModelConnection, addGraphModelContainer, addGraphModelNode, addGraphModelNode, addNode, addRelationship, addRelationship, doFindInputItem, doFindItem, doUpdateItem, filterVisuals, findItems, getConnectionsArray, getConnectionStyle, getGraphModelConnection, getGraphModelNode, getGraphStyle, getNodesArray, getNodesMap, getNodeStyle, getRawChildren, getSelectionFromWidget, getWidgetSelection, internalRefresh, removeGraphModelConnection, removeGraphModelNode, removeNode, removeRelationship
zoomTo
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, 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
getContentProvider, getInput, getLabelProvider, labelProviderChanged
addHelpListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, scrollDown, scrollUp, setData, setSelection
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSelection, setSelection
protected GraphWidget graph
public GraphViewer(Composite composite, int style)
composite
- style
- the style for the viewer and for the layout algorithmZestStyles#LAYOUT_GRID
,
ZestStyles#LAYOUT_TREE
,
ZestStyles#LAYOUT_RADIAL
,
ZestStyles#LAYOUT_SPRING
,
ZestStyles#NO_OVERLAPPING_NODES
,
ZestStyles#NODES_HIGHLIGHT_ADJACENT
,
ZestStyles.GESTURES_DISABLED
,
ZestStyles#ANIMATION_DISABLED
,
SWT.V_SCROLL
,
SWT.H_SCROLL
public GraphViewer(GraphWidget graph)
graph
- The initial graph widgetprotected void hookControl(Control control)
hookControl
in class StructuredViewer
protected void inputChanged(java.lang.Object input, java.lang.Object oldInput)
inputChanged
in class AbstractStructuredGraphViewer
public int getStyle()
public GraphWidget getGraphControl()
getGraphControl
in class AbstractStructuredGraphViewer
public void setLayoutAlgorithm(org.eclipse.gef4.layout.LayoutAlgorithm algorithm, boolean runLayout)
setLayoutAlgorithm
in class AbstractStructuredGraphViewer
algorithm
- the algorithm to layout the nodesrunLayout
- if the layout should be runpublic void setLayoutAlgorithm(org.eclipse.gef4.layout.LayoutAlgorithm algorithm)
AbstractStructuredGraphViewer
setLayoutAlgorithm
in class AbstractStructuredGraphViewer
public void setNodeStyle(int nodeStyle)
AbstractStructuredGraphViewer
setNodeStyle
in class AbstractStructuredGraphViewer
nodeStyle
- the style for the nodes.#ZestStyles
public void setContentProvider(IContentProvider contentProvider)
setContentProvider
in class StructuredViewer
public GraphItem findGraphItem(java.lang.Object element)
The
- user model node.public void applyLayout()
applyLayout
in class AbstractStructuredGraphViewer
protected void setSelectionToWidget(java.util.List l, boolean reveal)
setSelectionToWidget
in class AbstractStructuredGraphViewer
public Control getControl()
getControl
in class Viewer
public java.lang.Object[] getNodeElements()
getNodeElements
in class AbstractStructuredGraphViewer
public java.lang.Object[] getConnectionElements()
getConnectionElements
in class AbstractStructuredGraphViewer
public void reveal(java.lang.Object element)
reveal
in class AbstractStructuredGraphViewer
public void setConnectionStyle(int connectionStyle)
AbstractStructuredGraphViewer
setConnectionStyle
in class AbstractStructuredGraphViewer
connectionStyle
- the style for the connections.#ZestStyles
public void unReveal(java.lang.Object element)
unReveal
in class AbstractStructuredGraphViewer
public void addSelectionChangedListener(ISelectionChangedListener listener)
addSelectionChangedListener
in interface ISelectionProvider
addSelectionChangedListener
in class Viewer
public void removeSelectionChangedListener(ISelectionChangedListener listener)
removeSelectionChangedListener
in interface ISelectionProvider
removeSelectionChangedListener
in class Viewer
public void refresh(java.lang.Object element)
refresh
in class StructuredViewer
public void refresh(java.lang.Object element, boolean updateLabels)
refresh
in class StructuredViewer
public void update(java.lang.Object element, java.lang.String[] properties)
update
in class StructuredViewer
public void update(java.lang.Object[] elements, java.lang.String[] properties)
update
in class StructuredViewer
protected ZoomManager getZoomManager()
AbstractZoomableViewer
getZoomManager
in class AbstractZoomableViewer
protected org.eclipse.gef4.zest.core.viewers.internal.IStylingGraphModelFactory getFactory()
getFactory
in class AbstractStructuredGraphViewer
AbstractStructuredGraphViewer.getFactory()
protected org.eclipse.gef4.layout.LayoutAlgorithm getLayoutAlgorithm()
AbstractStructuredGraphViewer
getLayoutAlgorithm
in class AbstractStructuredGraphViewer
Copyright (c) 2014 itemis AG and others. All rights reserved.