Zest
1.5.0.201308190730

org.eclipse.zest.core.viewers
Class GraphViewer

java.lang.Object
  extended by StructuredViewer
      extended by org.eclipse.zest.core.viewers.AbstractZoomableViewer
          extended by org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer
              extended by org.eclipse.zest.core.viewers.GraphViewer

public class GraphViewer
extends org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer


Field Summary
protected  Graph graph
           
 
Constructor Summary
GraphViewer(Composite composite, int style)
          Initializes the viewer.
 
Method Summary
 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.zest.core.viewers.internal.IStylingGraphModelFactory getFactory()
          Returns the factory used to create the model.
 Graph getGraphControl()
           
protected  LayoutAlgorithm getLayoutAlgorithm()
          Gets the current layout algorithm.
 java.lang.Object[] getNodeElements()
           
 int getStyle()
          Gets the styles for this structuredViewer
protected  org.eclipse.zest.core.viewers.internal.ZoomManager getZoomManager()
          Returns a ZoomManager that zooming can be done on.
protected  void hookControl(Control control)
           
 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 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(java.util.List l, boolean reveal)
           
 void unReveal(java.lang.Object element)
           
 
Methods inherited from class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer
addConstraintAdapter, addNode, addRelationship, addRelationship, doFindInputItem, doFindItem, doUpdateItem, filterVisuals, findItems, getConnectionsArray, getConnectionStyle, getConstraintAdapters, getGraphStyle, getNodesArray, getNodeStyle, getRawChildren, getSelectionFromWidget, getWidgetSelection, inputChanged, internalRefresh, removeNode, removeRelationship
 
Methods inherited from class org.eclipse.zest.core.viewers.AbstractZoomableViewer
zoomTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graph

protected Graph graph
Constructor Detail

GraphViewer

public GraphViewer(Composite composite,
                   int style)
Initializes the viewer.

Parameters:
composite -
style - the style for the viewer and for the layout algorithm
See Also:
ZestStyles#LAYOUT_GRID, ZestStyles#LAYOUT_TREE, ZestStyles#LAYOUT_RADIAL, ZestStyles#LAYOUT_SPRING, ZestStyles#NO_OVERLAPPING_NODES, ZestStyles#NODES_HIGHLIGHT_ADJACENT, SWT.V_SCROLL, SWT.H_SCROLL
Method Detail

setControl

public void setControl(Graph graphModel)

hookControl

protected void hookControl(Control control)

getStyle

public int getStyle()
Gets the styles for this structuredViewer

Returns:

getGraphControl

public Graph getGraphControl()
Overrides:
getGraphControl in class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer

setLayoutAlgorithm

public void setLayoutAlgorithm(LayoutAlgorithm algorithm,
                               boolean runLayout)
Sets the layout algorithm to use for this viewer.

Specified by:
setLayoutAlgorithm in class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer
Parameters:
algorithm - the algorithm to layout the nodes
runLayout - if the layout should be run

setLayoutAlgorithm

public void setLayoutAlgorithm(LayoutAlgorithm algorithm)
Description copied from class: org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer
Equivalent to setLayoutAlgorithm(algorithm, false).

Overrides:
setLayoutAlgorithm in class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer

setNodeStyle

public void setNodeStyle(int nodeStyle)
Description copied from class: org.eclipse.zest.core.viewers.internal.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 class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer
Parameters:
nodeStyle - the style for the nodes.
See Also:
#ZestStyles

setContentProvider

public void setContentProvider(IContentProvider contentProvider)

findGraphItem

public GraphItem findGraphItem(java.lang.Object element)
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:
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 class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer

setSelectionToWidget

protected void setSelectionToWidget(java.util.List l,
                                    boolean reveal)
Overrides:
setSelectionToWidget in class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer

getControl

public Control getControl()

getNodeElements

public java.lang.Object[] getNodeElements()
Overrides:
getNodeElements in class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer

getConnectionElements

public java.lang.Object[] getConnectionElements()
Overrides:
getConnectionElements in class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer

reveal

public void reveal(java.lang.Object element)
Overrides:
reveal in class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer

setConnectionStyle

public void setConnectionStyle(int connectionStyle)
Description copied from class: org.eclipse.zest.core.viewers.internal.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 class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer
Parameters:
connectionStyle - the style for the connections.
See Also:
#ZestStyles

unReveal

public void unReveal(java.lang.Object element)
Overrides:
unReveal in class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer

addSelectionChangedListener

public void addSelectionChangedListener(ISelectionChangedListener listener)

removeSelectionChangedListener

public void removeSelectionChangedListener(ISelectionChangedListener listener)

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 class AbstractZoomableViewer
Returns:
a ZoomManager that zooming can be done on.

getFactory

protected org.eclipse.zest.core.viewers.internal.IStylingGraphModelFactory getFactory()
Description copied from class: org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer
Returns the factory used to create the model. This must not be called before the content provider is set.

Specified by:
getFactory in class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer
Returns:

getLayoutAlgorithm

protected LayoutAlgorithm getLayoutAlgorithm()
Description copied from class: org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer
Gets the current layout algorithm.

Specified by:
getLayoutAlgorithm in class org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer
Returns:
the current layout algorithm.

Zest
1.5.0.201308190730

Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.