Zest
1.5.0.201305060205

org.eclipse.zest.core.widgets
Class Graph

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.swt.widgets.Canvas
                      extended by org.eclipse.draw2d.FigureCanvas
                          extended by org.eclipse.zest.core.widgets.Graph
All Implemented Interfaces:
Drawable, IContainer

public class Graph
extends FigureCanvas
implements IContainer


Field Summary
static int ANIMATION_TIME
           
protected  java.util.List connections
           
 Color DARK_BLUE
           
 Color DEFAULT_NODE_COLOR
           
static int FISHEYE_ANIMATION_TIME
           
 Color GREY_BLUE
           
 Color HIGHLIGHT_ADJACENT_COLOR
           
 Color HIGHLIGHT_COLOR
           
 Color LIGHT_BLUE
           
 Color LIGHT_BLUE_CYAN
           
 Color LIGHT_YELLOW
           
 
Fields inherited from class org.eclipse.draw2d.FigureCanvas
ALWAYS, AUTOMATIC, NEVER
 
Fields inherited from class org.eclipse.swt.widgets.Control
view
 
Constructor Summary
Graph(Composite parent, int style)
          Constructor for a Graph.
 
Method Summary
 void addConstraintAdapter(ConstraintAdapter constraintAdapter)
          Adds a new constraint adapter to the list of constraint adapters
 void addSelectionListener(SelectionListener selectionListener)
          This adds a listener to the set of listeners that will be called when a selection event occurs.
 void applyLayout()
          Runs the layout on this graph.
 void dispose()
          Dispose of the nodes and edges when the graph is disposed.
 java.util.List getConnections()
          Gets the list of GraphModelConnection objects.
 int getConnectionStyle()
          Gets the default connection style.
 IFigure 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 findFigureAt
 Graph getGraph()
           
 Graph getGraphModel()
           
 int getItemType()
           
 LayoutAlgorithm getLayoutAlgorithm()
           
 java.util.List getNodes()
          Gets a list of the GraphModelNode children objects under the root node in this diagram.
 int getNodeStyle()
          Gets the default node style.
 ScalableFigure getRootLayer()
          Gets the root layer for this graph
 java.util.List getSelection()
          Gets the list of currently selected GraphNodes
 void notifyListeners(int eventType, Event event)
           
 void removeSelectionListener(SelectionListener selectionListener)
           
 void selectAll()
           
 void setConnectionStyle(int connectionStyle)
          Sets the default connection style.
 void setConstraintAdapters(java.util.List constraintAdapters)
          Sets the constraint adapters on this model
 void setLayoutAlgorithm(LayoutAlgorithm algorithm, boolean applyLayout)
          Sets the LayoutAlgorithm for this container and optionally applies it.
 void setNodeStyle(int nodeStyle)
          Sets the default node style.
 void setPreferredSize(int width, int height)
          Sets the preferred size of the layout area.
 void setSelection(GraphItem[] items)
          Changes the selection to the list of items
 java.lang.String 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, setViewport
 
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setIME
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
 
Methods 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, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, 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, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ANIMATION_TIME

public static final int ANIMATION_TIME
See Also:
Constant Field Values

FISHEYE_ANIMATION_TIME

public static final int FISHEYE_ANIMATION_TIME
See Also:
Constant Field Values

LIGHT_BLUE

public Color LIGHT_BLUE

LIGHT_BLUE_CYAN

public Color LIGHT_BLUE_CYAN

GREY_BLUE

public Color GREY_BLUE

DARK_BLUE

public Color DARK_BLUE

LIGHT_YELLOW

public Color LIGHT_YELLOW

HIGHLIGHT_COLOR

public Color HIGHLIGHT_COLOR

HIGHLIGHT_ADJACENT_COLOR

public Color HIGHLIGHT_ADJACENT_COLOR

DEFAULT_NODE_COLOR

public Color DEFAULT_NODE_COLOR

connections

protected java.util.List connections
Constructor Detail

Graph

public Graph(Composite parent,
             int style)
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 -
Method Detail

addSelectionListener

public void addSelectionListener(SelectionListener selectionListener)
This adds a listener to the set of listeners that will be called when a selection event occurs.

Parameters:
selectionListener -

removeSelectionListener

public void removeSelectionListener(SelectionListener selectionListener)

getNodes

public java.util.List 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:
getNodes in interface IContainer
Returns:
List of GraphModelNode objects

addConstraintAdapter

public void addConstraintAdapter(ConstraintAdapter constraintAdapter)
Adds a new constraint adapter to the list of constraint adapters

Parameters:
constraintAdapter -

setConstraintAdapters

public void setConstraintAdapters(java.util.List constraintAdapters)
Sets the constraint adapters on this model

Parameters:
constraintAdapters -

getRootLayer

public ScalableFigure getRootLayer()
Gets the root layer for this graph

Returns:

setConnectionStyle

public void setConnectionStyle(int connectionStyle)
Sets the default connection style.

Parameters:
connection - style the connection style to set
See Also:
org.eclipse.mylar.zest.core.widgets.ZestStyles

getConnectionStyle

public int getConnectionStyle()
Gets the default connection style.

Returns:
the connection style
See Also:
org.eclipse.mylar.zest.core.widgets.ZestStyles

setNodeStyle

public void setNodeStyle(int nodeStyle)
Sets the default node style.

Parameters:
nodeStyle - the node style to set
See Also:
org.eclipse.mylar.zest.core.widgets.ZestStyles

getNodeStyle

public int getNodeStyle()
Gets the default node style.

Returns:
the node style
See Also:
org.eclipse.mylar.zest.core.widgets.ZestStyles

getConnections

public java.util.List getConnections()
Gets the list of GraphModelConnection objects.

Returns:
list of GraphModelConnection objects

setSelection

public void setSelection(GraphItem[] items)
Changes the selection to the list of items

Parameters:
l -

selectAll

public void selectAll()

getSelection

public java.util.List getSelection()
Gets the list of currently selected GraphNodes

Returns:
Currently selected graph node

toString

public java.lang.String toString()
Overrides:
toString in class Widget

getGraphModel

public Graph getGraphModel()

dispose

public void dispose()
Dispose of the nodes and edges when the graph is disposed.

Overrides:
dispose in class Widget

applyLayout

public void applyLayout()
Runs the layout on this graph. It uses the reveal listener to run the layout only if the view is visible. Otherwise it will be deferred until after the view is available.

Specified by:
applyLayout in interface IContainer

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 -

setLayoutAlgorithm

public void setLayoutAlgorithm(LayoutAlgorithm algorithm,
                               boolean applyLayout)
Description copied from interface: IContainer
Sets the LayoutAlgorithm for this container and optionally applies it.

Specified by:
setLayoutAlgorithm in interface IContainer
Parameters:
algorithm -

getLayoutAlgorithm

public LayoutAlgorithm getLayoutAlgorithm()

getFigureAt

public IFigure 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 findFigureAt


notifyListeners

public void notifyListeners(int eventType,
                            Event event)
Overrides:
notifyListeners in class Widget

getGraph

public Graph getGraph()
Specified by:
getGraph in interface IContainer

getItemType

public int getItemType()
Specified by:
getItemType in interface IContainer

Zest
1.5.0.201305060205

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