public class GraphWidget extends org.eclipse.draw2d.FigureCanvas implements IContainer
| Modifier and Type | Field and Description |
|---|---|
static int |
ANIMATION_TIME |
protected java.util.List<GraphConnection> |
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 |
| Constructor and Description |
|---|
GraphWidget(Composite parent,
int style)
Constructor for a Graph.
|
GraphWidget(org.eclipse.gef4.graph.Graph graph,
Composite parent,
int style)
Constructor for a GraphWidget, created from a given Graph data structure.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFisheyeListener(FisheyeListener listener)
Adds a listener that will be notified when fisheyed figures change in
this graph.
|
void |
addLayoutFilter(LayoutFilter filter)
Adds a filter used for hiding elements from layout algorithm.
|
void |
addNode(GraphNode node) |
void |
addSelectionListener(SelectionListener selectionListener)
This adds a listener to the set of listeners that will be called when a
selection event occurs.
|
void |
addSubgraphFigure(org.eclipse.draw2d.IFigure figure) |
void |
applyLayout()
Runs the layout on this graph.
|
void |
applyLayoutNow()
Apply this graphs's layout cleanly and display all changes.
|
boolean |
canCollapse(GraphNode node) |
boolean |
canExpand(GraphNode node) |
void |
clear()
Clear the graph of all its content.
|
void |
dispose()
Dispose of the nodes and edges when the graph is disposed.
|
java.util.List<GraphConnection> |
getConnections()
Gets the list of GraphModelConnection objects.
|
int |
getConnectionStyle()
Gets the default connection style.
|
IConnectionDecorator |
getDefaultConnectionDecorator() |
IConnectionDecorator |
getDefaultDirectedConnectionDecorator() |
org.eclipse.gef4.layout.interfaces.ExpandCollapseManager |
getExpandCollapseManager() |
org.eclipse.draw2d.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
|
GraphWidget |
getGraph() |
Widget |
getItem() |
int |
getItemType() |
org.eclipse.gef4.layout.LayoutAlgorithm |
getLayoutAlgorithm() |
org.eclipse.gef4.geometry.planar.Rectangle |
getLayoutBounds() |
org.eclipse.gef4.zest.core.widgets.InternalLayoutContext |
getLayoutContext() |
java.util.List<GraphNode> |
getNodes()
Gets a list of the GraphNode children objects under the root node in this
graph.
|
int |
getNodeStyle()
Gets the default node style.
|
org.eclipse.draw2d.geometry.Dimension |
getPreferredSize() |
org.eclipse.draw2d.ScalableFigure |
getRootLayer()
Gets the root layer for this graph
|
java.util.List<GraphItem> |
getSelection()
Gets the list of currently selected GraphNodes
|
SubgraphFactory |
getSubgraphFactory() |
ZoomManager |
getZoomManager()
Returns the ZoomManager component used for scaling the graph widget.
|
boolean |
isAnimationEnabled() |
boolean |
isDynamicLayoutEnabled() |
void |
notifyListeners(int eventType,
Event event) |
void |
removeFisheyeListener(FisheyeListener listener) |
void |
removeLayoutFilter(LayoutFilter filter)
Removes given layout filter.
|
void |
removeSelectionListener(SelectionListener selectionListener) |
void |
selectAll() |
void |
setAnimationEnabled(boolean animate) |
void |
setConnectionStyle(int connectionStyle)
Sets the default connection style.
|
void |
setDefaultConnectionDecorator(IConnectionDecorator connectionDecorator)
Sets the connection decorator used for adding source and target
decorations.
|
void |
setDefaultDirectedConnectionDecorator(IConnectionDecorator connectionDecorator)
Sets the connection decorator used for adding source and target
decorations.
|
void |
setDynamicLayout(boolean enabled)
Enables or disables dynamic layout (that is layout algorithm performing
layout in background or when certain events occur).
|
void |
setExpandCollapseManager(org.eclipse.gef4.layout.interfaces.ExpandCollapseManager expandCollapseManager) |
void |
setExpanded(GraphNode node,
boolean expanded) |
void |
setLayoutAlgorithm(org.eclipse.gef4.layout.LayoutAlgorithm algorithm,
boolean applyLayout) |
void |
setNodeStyle(int nodeStyle)
Sets the default node style.
|
void |
setPreferredSize(int width,
int height)
Sets the preferred size of the layout area.
|
void |
setRouter(org.eclipse.draw2d.ConnectionRouter connectionRouter)
Updates the connection router and applies to to all existing connections
that have no connection routers set to them.
|
void |
setSelection(GraphItem[] items)
Changes the selection to the list of items
|
void |
setSubgraphFactory(SubgraphFactory factory) |
java.lang.String |
toString() |
computeSize, getContents, getFont, getHorizontalScrollBarVisibility, getLightweightSystem, getVerticalScrollBarVisibility, getViewport, scrollSmoothTo, scrollTo, scrollToX, scrollToY, setBorder, setContents, setFont, setHorizontalScrollBarVisibility, setScrollBarVisibility, setVerticalScrollBarVisibility, setViewportdrawBackground, getCaret, getIME, scroll, setCaret, setIMEchanged, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabListcomputeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBaraddControlListener, 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, updateaddDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, removeDisposeListener, removeListener, removeListener, reskin, setData, setDatapublic static final int ANIMATION_TIME
public static final int FISHEYE_ANIMATION_TIME
public Color LIGHT_BLUE
public Color LIGHT_BLUE_CYAN
public Color GREY_BLUE
public Color DARK_BLUE
public Color LIGHT_YELLOW
public Color HIGHLIGHT_COLOR
public Color HIGHLIGHT_ADJACENT_COLOR
public Color DEFAULT_NODE_COLOR
protected java.util.List<GraphConnection> connections
public GraphWidget(Composite parent, int style)
parent - style - ZestStyles.GESTURES_DISABLED,
ZestStyles#ANIMATION_DISABLEDpublic GraphWidget(org.eclipse.gef4.graph.Graph graph,
Composite parent,
int style)
graph - parent - style - ZestStyles.GESTURES_DISABLED,
ZestStyles#ANIMATION_DISABLEDpublic void addSelectionListener(SelectionListener selectionListener)
selectionListener - public void removeSelectionListener(SelectionListener selectionListener)
public java.util.List<GraphNode> getNodes()
getNodes in interface IContainerpublic org.eclipse.draw2d.ScalableFigure getRootLayer()
public void setConnectionStyle(int connectionStyle)
connection - style the connection style to setorg.eclipse.mylar.zest.core.widgets.ZestStylespublic int getConnectionStyle()
org.eclipse.mylar.zest.core.widgets.ZestStylespublic void setNodeStyle(int nodeStyle)
nodeStyle - the node style to setorg.eclipse.mylar.zest.core.widgets.ZestStylespublic int getNodeStyle()
org.eclipse.mylar.zest.core.widgets.ZestStylespublic java.util.List<GraphConnection> getConnections()
getConnections in interface IContainerpublic void setSelection(GraphItem[] items)
l - public void selectAll()
public java.util.List<GraphItem> getSelection()
public void dispose()
public void applyLayout()
applyLayout in interface IContainerpublic void applyLayoutNow()
public void setDynamicLayout(boolean enabled)
enabled - public boolean isDynamicLayoutEnabled()
setDynamicLayout(boolean))public void setPreferredSize(int width,
int height)
width - height - public org.eclipse.draw2d.geometry.Dimension getPreferredSize()
public org.eclipse.gef4.zest.core.widgets.InternalLayoutContext getLayoutContext()
getLayoutContext in interface IContainerpublic void setLayoutAlgorithm(org.eclipse.gef4.layout.LayoutAlgorithm algorithm,
boolean applyLayout)
setLayoutAlgorithm in interface IContaineralgorithm - public org.eclipse.gef4.layout.LayoutAlgorithm getLayoutAlgorithm()
public void setSubgraphFactory(SubgraphFactory factory)
public SubgraphFactory getSubgraphFactory()
public void setExpandCollapseManager(org.eclipse.gef4.layout.interfaces.ExpandCollapseManager expandCollapseManager)
public org.eclipse.gef4.layout.interfaces.ExpandCollapseManager getExpandCollapseManager()
public void addLayoutFilter(LayoutFilter filter)
filter - filter to addpublic void removeLayoutFilter(LayoutFilter filter)
filter - filter to removepublic org.eclipse.draw2d.IFigure getFigureAt(int x,
int y)
public void notifyListeners(int eventType,
Event event)
notifyListeners in class Widgetpublic void clear()
public void addNode(GraphNode node)
addNode in interface IContainerpublic void addSubgraphFigure(org.eclipse.draw2d.IFigure figure)
addSubgraphFigure in interface IContainerpublic void addFisheyeListener(FisheyeListener listener)
listener - listener to addpublic void removeFisheyeListener(FisheyeListener listener)
public int getItemType()
getItemType in interface IContainerpublic void setExpanded(GraphNode node, boolean expanded)
public boolean canExpand(GraphNode node)
public boolean canCollapse(GraphNode node)
public GraphWidget getGraph()
getGraph in interface IContainerpublic Widget getItem()
getItem in interface IContainerpublic org.eclipse.gef4.geometry.planar.Rectangle getLayoutBounds()
getLayoutBounds in interface IContainerpublic IConnectionDecorator getDefaultConnectionDecorator()
public void setDefaultConnectionDecorator(IConnectionDecorator connectionDecorator)
connectionDecorator - the defaultConnectionDecorator to set; or null to reset to
defaultpublic IConnectionDecorator getDefaultDirectedConnectionDecorator()
public void setDefaultDirectedConnectionDecorator(IConnectionDecorator connectionDecorator)
connectionDecorator - the defaultConnectionDecorator to set; or null to reset to
defaultpublic void setRouter(org.eclipse.draw2d.ConnectionRouter connectionRouter)
connectionRouter - public ZoomManager getZoomManager()
public boolean isAnimationEnabled()
public void setAnimationEnabled(boolean animate)
animate - Pass true to enable animation for this graph.Copyright (c) 2014 itemis AG and others. All rights reserved.