Package org.eclipse.zest.core.widgets
Class GraphConnection
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Item
org.eclipse.zest.core.widgets.GraphItem
org.eclipse.zest.core.widgets.GraphConnection
This is the graph connection model which stores the source and destination
 nodes and the properties of this connection (color, line width etc).
- 
Field SummaryFields inherited from class org.eclipse.zest.core.widgets.GraphItemCONNECTION, CONTAINER, GRAPH, NODE
- 
Constructor SummaryConstructorsConstructorDescriptionGraphConnection(Graph graphModel, int style, GraphNode source, GraphNode destination) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected PolylineConnectionexpose to allow to use custom figuresvoidchangeLineColor(Color color) Sets the connection color.protected PolylineConnectionexpose to allow to use custom figuresvoiddispose()intReturns the style of this connection.Gets the target node for this relationshipDeprecated, for removal: This API element is subject to removal in a future version.getFont()Gets the font for the label on this connectionGets the graph model that this connection is inintGets the graph item type.Deprecated, for removal: This API element is subject to removal in a future version.Not used in Zest 2.x.Returns the color of this connection.intReturns the connection line style.intReturns the connection line width.Gets the source node for this relationshipGets the current tooltip for this node.doubleGets the weight of this connection.voidHighlights this node.booleanbooleanbooleanReturns true if this connection is highlighted, false otherwisebooleanGet the visibility of this item.voidregisterConnection(GraphNode source, GraphNode destination) voidsetConnectionStyle(int style) Returns the style of this connection.voidsetCurveDepth(int depth) Sets the curve depth of the arc.voidsetDirected(boolean directed) voidSets the font for the label on this connection.voidsetHighlightColor(Color color) Sets the highlight color.voidsetLineColor(Color color) Perminently sets the color of this line to the given color.voidsetLineStyle(int lineStyle) Sets the connection line style.voidsetLineWidth(int lineWidth) Sets the connection line width.voidsetRouter(ConnectionRouter router) Sets the connection router of the connectionvoidvoidsetTooltip(IFigure tooltip) Sets the tooltip on this node.voidsetVisible(boolean visible) Set the visibility of this item.voidsetWeight(double weight) Sets the weight for this connection.toString()Returns a string like 'source -> destination'voidUnhighlights this node.Methods inherited from class org.eclipse.zest.core.widgets.GraphItemcheckStyleMethods inherited from class org.eclipse.swt.widgets.ItemcheckSubclass, getImage, getText, setImageMethods inherited from class org.eclipse.swt.widgets.WidgetaddDisposeListener, addListener, addTypedListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setData
- 
Constructor Details- 
GraphConnection
 
- 
- 
Method Details- 
registerConnection- Since:
- 1.10
 
- 
disposepublic void dispose()
- 
isDisposedpublic boolean isDisposed()- Overrides:
- isDisposedin class- Widget
 
- 
getConnectionFigure
- 
getLayoutRelationshipDeprecated, for removal: This API element is subject to removal in a future version.Not used in Zest 2.x. This class will be removed in a future release in accordance with the two year deprecation policy.Gets a proxy to this connection that can be used with the Zest layout engine- @nooverride
- This method is not intended to be re-implemented or extended by clients.
- @noreference
- This method is not intended to be referenced by clients.
 
- 
getExternalConnectionDeprecated, for removal: This API element is subject to removal in a future version.UseWidget.getData()instead. This class will be removed in a future release in accordance with the two year deprecation policy.Gets the external connection object.- Returns:
- Object
- @nooverride
- This method is not intended to be re-implemented or extended by clients.
- @noreference
- This method is not intended to be referenced by clients.
 
- 
toStringReturns a string like 'source -> destination'
- 
getConnectionStylepublic int getConnectionStyle()Returns the style of this connection. Valid styles are those that begin with CONNECTION in ZestStyles.- Returns:
- the style of this connection.
- See Also:
 
- 
setConnectionStylepublic void setConnectionStyle(int style) Returns the style of this connection. Valid styles are those that begin with CONNECTION in ZestStyles.- Parameters:
- style- the style of this connection.
- See Also:
 
- 
getWeightInLayoutpublic double getWeightInLayout()Gets the weight of this connection. The weight must be in {-1, [0-1]}. A weight of -1 means that there is no force/tension between the nodes. A weight of 0 results in the maximum spring length being used (farthest apart). A weight of 1 results in the minimum spring length being used (closest together).- Returns:
- the weight: {-1, [0 - 1]}.
- See Also:
 
- 
getFontGets the font for the label on this connection
- 
setFontSets the font for the label on this connection.
- 
setWeightpublic void setWeight(double weight) Sets the weight for this connection. The weight must be in {-1, [0-1]}. A weight of -1 means that there is no force/tension between the nodes. A weight of 0 results in the maximum spring length being used (farthest apart). A weight of 1 results in the minimum spring length being used (closest together).
- 
getLineColorReturns the color of this connection.- Returns:
- Color
 
- 
setHighlightColorSets the highlight color.- Parameters:
- color- the color to use for highlighting.
 
- 
getHighlightColor- Returns:
- the highlight color
 
- 
setLineColorPerminently sets the color of this line to the given color. This will become the color of the line when it is not highlighted. If you would like to temporarily change the color of the line, use changeLineColor.- Parameters:
- color- the color to be set.
- See Also:
 
- 
changeLineColorSets the connection color.- Parameters:
- color-
 
- 
setTooltipSets the tooltip on this node. This tooltip will display if the mouse hovers over the node. Setting the tooltip has no effect if a custom figure has been set.
- 
getTooltipGets the current tooltip for this node. The tooltip returned is meaningless if a custom figure has been set.
- 
getLineWidthpublic int getLineWidth()Returns the connection line width.- Returns:
- int
 
- 
setLineWidthpublic void setLineWidth(int lineWidth) Sets the connection line width.- Parameters:
- lineWidth-
 
- 
getLineStylepublic int getLineStyle()Returns the connection line style.- Returns:
- int
 
- 
setLineStylepublic void setLineStyle(int lineStyle) Sets the connection line style.- Parameters:
- lineStyle-
 
- 
getSourceGets the source node for this relationship- Returns:
- GraphModelNode
 
- 
getDestinationGets the target node for this relationship- Returns:
- GraphModelNode
 
- 
highlightpublic void highlight()Highlights this node. Uses the default highlight color.
- 
unhighlightpublic void unhighlight()Unhighlights this node. Uses the default color.- Specified by:
- unhighlightin class- GraphItem
 
- 
isHighlightedpublic boolean isHighlighted()Returns true if this connection is highlighted, false otherwise- Overrides:
- isHighlightedin class- GraphItem
- Returns:
- boolean state of highlight
- Since:
- 1.9
 
- 
getGraphModelGets the graph model that this connection is in- Specified by:
- getGraphModelin class- GraphItem
- Returns:
- The graph model that this connection is contained in
 
- 
setCurveDepthpublic void setCurveDepth(int depth) Sets the curve depth of the arc. The curve depth is defined as the maximum distance from any point on the chord (i.e. a vector normal to the chord with magnitude d). If 0 is set, a Polyline Connection will be used, otherwise a PolylineArcConnectoin will be used. Negative depths are also supported.- Parameters:
- depth- The depth of the curve
 
- 
getItemTypepublic int getItemType()Description copied from class:GraphItemGets the graph item type. The item type is one of: GRAPH, NODE or CONNECTION- Specified by:
- getItemTypein class- GraphItem
 
- 
setVisiblepublic void setVisible(boolean visible) Description copied from class:GraphItemSet the visibility of this item.- Specified by:
- setVisiblein class- GraphItem
- Parameters:
- visible- whether or not this item is visible.
 
- 
isVisiblepublic boolean isVisible()Description copied from class:GraphItemGet the visibility of this item.
- 
setText
- 
isDirectedpublic boolean isDirected()- Since:
- 1.14
 
- 
setDirectedpublic void setDirected(boolean directed) - Since:
- 1.14
 
- 
createFigureexpose to allow to use custom figures- Since:
- 1.7
 
- 
cachedOrNewConnectionFigureexpose to allow to use custom figures- Since:
- 1.7
 
- 
setRouterSets the connection router of the connection- Parameters:
- router-
- Since:
- 1.14
 
 
- 
Widget.getData()instead.