com.tensegrity.graph.view
Interface VisualEdge

All Superinterfaces:
Attributable, AttributableOnSet, Layoutable, LayoutableEdge, VisualGraphObject

public interface VisualEdge
extends VisualGraphObject, LayoutableEdge

This interface represents the functionality of any potential Edge representation. By incorporating the functionality of a Composite object, it becomes possible to assign complex shapes and styles to an instance of this class.

IMPORTANT NOTE: Please keep in mind that there is a 1:n relationship between an Edge and a VisualEdge. Thus the getEdge() method called on an instance is capable of returning the same reference as any other instance.

Constructing a VisualEdge is done by means of a GraphViewFactory, which will hide the particular implementation classes from client code.

Isolated and non-isolated VisualEdge instances require individual handling, since no model counterparts exists for isolated edges. The Graph simply does not know about isolated edges. If you want to add a VisualEdge to a VisualGraph or a VisualSubgraph and it is not connected, then no model object needs to exist. If the VisualEdge is to be connected however, you must add the corresponding model Edge to the associated Graph or Subgraph. The model object can be obtained by invoking getEdge().

The distinction between isolated and connected VisualEdge objects introduces extra overhead when dealing with VisualGraphand VisualSubgraph instances. If you come from an academic background, it is often helpful not to consider isolated, unconnected edges at all, since graph theory does not take them into account. Strictly speaking, isolated edges do not exist. The model representation, as provided by Graph or Subgraph, is guaranteed not to contain any non-connected edges and can be used with regular algorithms and graph processing tools.

The two endpoints of a VisualEdge are called source and target and they define the current state connection state of a VisualEdge. The source and target can be connected to an instance of VisualNode which can be retrieved by invoking the methods getVisualSource() and getVisualTarget() respectively. These methods return null if a connection is not registered. A connection on one side of a VisualEdge to a VisualNode requires the additional assignment of a VisualPort, which must be part of the SAME VisualNode that the connection is assigned to. In case the source-end of a VisualEdge is currently not connected, it is a required invariant that both the methods getVisualSource() and getVisualSourcePort() return null. In the case the source end is connected, both methods must return non-null references. The same is true for the methods that deal with the target-end of a VisualEdge.

Version:
$Id: VisualEdge.java,v 1.36 2005/03/24 09:56:54 SharokhKhani Exp $
Author:
Stepan Rutz
See Also:
Edge, VisualGraph, VisualSubgraph, VisualNode, VisualPort, Graph, Subgraph, Node, Port, VisualEdgeListener, CompositeLine

Field Summary
 
Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
TREE_SUBSET_POSTFIX
 
Fields inherited from interface com.tensegrity.graph.layout.LayoutableEdge
EDGE_TYPE_CURVE, EDGE_TYPE_DYNAMIC, EDGE_TYPE_ORTHOGONAL, EDGE_TYPE_STRAIGHT, LABEL_POSITION_CENTER, LABEL_POSITION_CENTER_END, LABEL_POSITION_CENTER_START, LABEL_POSITION_FREE, LABEL_POSITION_HEAD, LABEL_POSITION_HEAD_END, LABEL_POSITION_HEAD_START, LABEL_POSITION_TAIL, LABEL_POSITION_TAIL_END, LABEL_POSITION_TAIL_START
 
Method Summary
 void addVisualEdgeListener(VisualEdgeListener listener)
          Adds a VisualEdgeListener to this VisualEdge.
 VisualEdge deepCopy(Edge edge, VisualNode visualsource, VisualNode visualtarget, VisualPort visualsourceport, VisualPort visualtargetport)
          Makes a deep independant copy of a VisualEdge.
 CompositeLine getComposite()
          Returns the instance of the CompositeLine associated to the VisualEdge instance.
 Edge getEdge()
          Returns the reference to the Edge this VisualEdge is associated with
 VisualEdgeInfo getVisualEdgeInfo()
          Returns the VisualEdgeInfo associated with this VisualEdge.
 VisualNode getVisualSource()
          Gets the VisualNode at the source end of this VisualEdge.
 VisualPort getVisualSourcePort()
          Returns the VisualPort VisualPort at the source end of this instance.
 VisualNode getVisualTarget()
          Gets the VisualNode at the target end of this VisualEdge.
 VisualPort getVisualTargetPort()
          Returns the VisualPort VisualPort at the target-end of this instance.
 boolean isDetached()
          Returns true if this VisualEdge has been manipulated so that it is detached.
 void removeVisualEdgeListener(VisualEdgeListener listener)
          Removes a VisualEdgeListener from this VisualEdge.
 void setVisualEdgeInfo(VisualEdgeInfo visualEdgeInfo)
          Sets the VisualEdgeInfo associated with this VisualEdge.
 void updatePosition()
          This method updates the position of this VisualEdge instance according to the ports it is connected to.
 void updatePosition(boolean updatesource, boolean updatetarget)
          This method updates the position of this VisualEdge instance according to the ports it is connected to.
 
Methods inherited from interface com.tensegrity.graph.view.VisualGraphObject
deepCopy, getBaseComposite, getGraphObject, getID, getParentContainer, getRootContainer, getRule, getRuleRegistry, getUniqueID, isPinned, registerVetoableVisualEventMediator, registerVisualEventMediator, setPinned, setRule, setRuleRegistry
 
Methods inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
addAttributableOnSetListener, areAttributableEventsEnabled, disableAttributableEvents, enableAttributableEvents, getAttributes, getAttributesTree, removeAttributableOnSetListener, setAttributes, setAttributesTree
 
Methods inherited from interface com.tensegrity.generic.attribute.Attributable
getAttribute, getAttributeType, getAttributeValue, setAttribute, setAttributeValue
 
Methods inherited from interface com.tensegrity.graph.layout.Layoutable
getEdgeLayoutContext, getLayoutAttributeSet, getLayoutContext, getNodeLayoutContext, setEdgeLayoutContext, setLayoutAttributes, setLayoutContext, setNodeLayoutContext
 
Methods inherited from interface com.tensegrity.graph.layout.LayoutableEdge
getCoordinateAt, getCoordinateCount, getCoordinates, getInnerSourceNode, getInnerTargetNode, getLabelAnchor, getLabelLocation, getLabelPlacement, getLabelPositioning, getLabelSize, getMarkerBeginSize, getMarkerEndSize, getSourceNode, getSourcePortId, getTargetNode, getTargetPortId, getType, hasLabel, insertCoordinate, insertCoordinate, layoutLabel, reassignSourcePortByID, reassignSourcePortByPredicate, reassignSourceToPortByAngle, reassignTargetPortByID, reassignTargetPortByPredicate, reassignTargetToPortByAngle, reassignToNextPort, removeCoordinate, removeCoordinates, setCoordinateAt, setCoordinates, setType
 

Method Detail

getComposite

public CompositeLine getComposite()
Returns the instance of the CompositeLine associated to the VisualEdge instance.

Returns:
the associated CompositeLine instance.

Find more information in the class documentation


getEdge

public Edge getEdge()
Returns the reference to the Edge this VisualEdge is associated with. (1:n relationship between edges and VisualEdges)

Returns:
the Edge this VisualEdge is associated with.
See Also:
Edge

Find more information in the class documentation


getVisualEdgeInfo

public VisualEdgeInfo getVisualEdgeInfo()
Returns the VisualEdgeInfo associated with this VisualEdge.

Returns:
the VisualEdgeInfo associated with this VisualEdge. The returned value may be null if no info is associated with this VisualEdge.

Find more information in the class documentation


setVisualEdgeInfo

public void setVisualEdgeInfo(VisualEdgeInfo visualEdgeInfo)
Sets the VisualEdgeInfo associated with this VisualEdge.

Parameters:
visualEdgeInfo - the VisualEdgeInfo to associate with this VisualEdge.

getVisualSource

public VisualNode getVisualSource()
Gets the VisualNode at the source end of this VisualEdge.

Returns:
the VisualNode at the start of this VisualEdge.
See Also:
VisualNode

Find more information in the class documentation


getVisualTarget

public VisualNode getVisualTarget()
Gets the VisualNode at the target end of this VisualEdge.

Returns:
the VisualNode at the end of this VisualEdge.
See Also:
VisualNode

Find more information in the class documentation


getVisualSourcePort

public VisualPort getVisualSourcePort()
Returns the VisualPort VisualPort at the source end of this instance. The field may be null if the VisualEdge is currently detached.

Returns:
VisualPort at the source end of the receiver.
See Also:
VisualPort

Find more information in the class documentation


getVisualTargetPort

public VisualPort getVisualTargetPort()
Returns the VisualPort VisualPort at the target-end of this instance. The field may be null if the VisualEdge is currently detached.

Returns:
VisualPort at the target end of the receiver.
See Also:
VisualPort

Find more information in the class documentation


addVisualEdgeListener

public void addVisualEdgeListener(VisualEdgeListener listener)
Adds a VisualEdgeListener to this VisualEdge.

Parameters:
listener - the VisualEdgeListener to add to this VisualEdge.

removeVisualEdgeListener

public void removeVisualEdgeListener(VisualEdgeListener listener)
Removes a VisualEdgeListener from this VisualEdge.

Parameters:
listener - the VisualEdgeListener to remove from this VisualEdge.

updatePosition

public void updatePosition(boolean updatesource,
                           boolean updatetarget)
This method updates the position of this VisualEdge instance according to the ports it is connected to. If this VisualEdge is not connected to a VisualPort then invoking the method will not trigger and action.

Parameters:
updatesource - flag about whether to update the source-end of this VisualEdge.
updatetarget - flag about whether to update the target-end of this VisualEdge.

updatePosition

public void updatePosition()
This method updates the position of this VisualEdge instance according to the ports it is connected to. If this VisualEdge is not connected to a VisualPort then invoking the method will not trigger and action.

Find more information in the class documentation


isDetached

public boolean isDetached()
Returns true if this VisualEdge has been manipulated so that it is detached. This condition is only true if at least one end of the edge was previously connected and is not connected right now anymore.

Specified by:
isDetached in interface LayoutableEdge
Returns:
true if this VisualEdge has been manipulated so that it is detached.

deepCopy

public VisualEdge deepCopy(Edge edge,
                           VisualNode visualsource,
                           VisualNode visualtarget,
                           VisualPort visualsourceport,
                           VisualPort visualtargetport)
Makes a deep independant copy of a VisualEdge.

Parameters:
edge - model-edge to refer to.
visualsource - the VisualNode that is the source of the copied VisualEdge.
visualtarget - the VisualNode that is the target of the copied VisualEdge.
visualsourceport - the source VisualPort of the VisualEdge.
visualtargetport - the target VisualPort of the VisualEdge.
Returns:
a deep copy of this instance.
See Also:
Edge, VisualNode, VisualPort


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.