com.tensegrity.graph.view
Interface VisualNode

All Superinterfaces:
Attributable, AttributableOnSet, Layoutable, LayoutableNode, VisualGraphObject
All Known Subinterfaces:
VisualSubgraph

public interface VisualNode
extends VisualGraphObject, LayoutableNode

This interface represents the functionality of any potential Node 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 Node and VisualNode. Thus the getNode() method of an object of this class can be the same reference as the one that is returned by other VisualNode instances.

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

The associated model Node can be obtained by invoking the getNode() method.

VisualNode objects that are dereferenced will be garbage collected. You must remove the instance from a Container first.

VisualNode can optionally be associated with VisualNodeInfo objects. These user-defined objects are one way to associate custom information with instances of this class.

Version:
$Id: VisualNode.java,v 1.51 2006/04/11 11:42:11 MichaelKegel Exp $
Author:
Stepan Rutz, MichaelKegel
See Also:
Node, VisualNodeListener, Composite

Field Summary
static int DEFAULT_PORT
          constant that tells about the expected arguments when calling getVisualPorts().
static int DIRECTION_PORT
          constant that tells about the expected arguments when calling getVisualPorts().
static int NO_ARGUMENT
          a constant used as argument for the port reassignment
static int SHORTESTPATH_ARGUMENT
          a constant used as argument for the port reassignment
static int SHORTESTPATH_ARGUMENT_FLAT
          a constant used as argument for the port reassignment
 
Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
TREE_SUBSET_POSTFIX
 
Fields inherited from interface com.tensegrity.graph.layout.LayoutableNode
BBOXMASK_INCLUDE_ALL, BBOXMASK_INCLUDE_EXTERNALS_ALL, BBOXMASK_INCLUDE_EXTERNALS_BACK, BBOXMASK_INCLUDE_EXTERNALS_BOTTOM, BBOXMASK_INCLUDE_EXTERNALS_FRONT, BBOXMASK_INCLUDE_EXTERNALS_LEFT, BBOXMASK_INCLUDE_EXTERNALS_RIGHT, BBOXMASK_INCLUDE_EXTERNALS_TOP, BBOXMASK_INCLUDE_MARKER, BBOXMASK_INCLUDE_SHADOW, BBOXMASK_INCLUDE_STROKE
 
Method Summary
 void addVisualNodeListener(VisualNodeListener listener)
          Adds a VisualNodeListener to this VisualNode.
 void adjustEdges()
          Updates all adjacent edgs which are registered at ports of this visualnode.
 VisualNode deepCopy(Node node)
          Returns a deep copy of this visual node which is associated with the given node.
 void deepCopyPorts(VisualGraph visualgraph, VisualNode visualnode, Node node)
          Performs a deep copy of the ports of this visualnode.
 java.util.List getAdjacentVisualEdges()
           
 java.util.List getAdjacentVisualNodes()
           
 Composite getComposite()
          Returns the instance of the Composite associated to the VisualNode instance.
 int getDegree(boolean countIsolatedEdges)
           
 int getHierarchicalDegree(boolean countIsolatedEdges)
           
 int getHierarchicalIndegree(boolean countIsolatedEdges)
           
 int getHierarchicalOutdegree(boolean countIsolatedEdges)
           
 java.util.List getInboundVisualEdges()
           
 java.util.List getInboundVisualNodes()
           
 int getIndegree(boolean countIsolatedEdges)
           
 Node getNode()
          Returns the reference to the node this VisualNode is associated with.
 java.util.List getOutboundVisualEdges()
           
 java.util.List getOutboundVisualNodes()
           
 int getOutdegree(boolean countIsolatedEdges)
           
 VisualNodeInfo getVisualNodeInfo()
          Returns the VisualNodeInfo associated with this VisualNode.
 VisualPort getVisualPortByID(long id)
          Returns the VisualPort that has the id given by id.
 VisualPort getVisualPortByName(java.lang.String name)
          Returns the VisualPort with the name given by name or null if no VisualPort was found.
 java.util.List getVisualPorts()
          Returns a list of the VisualPorts of this VisualNode.
 void internalResetVisualPortNumbers()
          This method is for internal use only and should never be invoked by the client directly.
 VisualPort reassignVisualPort(int specifier, java.lang.Object[] args)
          Returns the visual port that fits to the arguments given by args.
 void removeVisualNodeListener(VisualNodeListener listener)
          Removes a VisualNodeListener from this VisualNode.
 void repositionVisualPorts()
          Internally readjust ports with the standard names "CenterPort", "WestPort", "EastPort", "NorthPort", "CenterPort" to their home positions.
 void setVisualNodeInfo(VisualNodeInfo visualNodeInfo)
          Sets the VisualNodeInfo associated with this VisualNode.
 void setVisualPorts(java.util.List visualports)
          Sets the List of visual ports given by ports as the new ports of this visual node.
 
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.LayoutableNode
getBoundingBox, getBoundingBox, getLocation, getPortCoordinate, getPortDirection, getPorts, getSize, layout, setLocation
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
constant that tells about the expected arguments when calling getVisualPorts().

See Also:
Constant Field Values

DIRECTION_PORT

public static final int DIRECTION_PORT
constant that tells about the expected arguments when calling getVisualPorts().

See Also:
Constant Field Values

NO_ARGUMENT

public static final int NO_ARGUMENT
a constant used as argument for the port reassignment

See Also:
Constant Field Values

SHORTESTPATH_ARGUMENT

public static final int SHORTESTPATH_ARGUMENT
a constant used as argument for the port reassignment

See Also:
Constant Field Values

SHORTESTPATH_ARGUMENT_FLAT

public static final int SHORTESTPATH_ARGUMENT_FLAT
a constant used as argument for the port reassignment

See Also:
Constant Field Values
Method Detail

getComposite

public Composite getComposite()
Returns the instance of the Composite associated to the VisualNode instance.

Returns:
the associated Composite instance

Find more information in the class documentation


getNode

public Node getNode()
Returns the reference to the node this VisualNode is associated with. (there is a 1:n relationship between Nodes and VisualNodes)

Returns:
the node this VisualNode is associated with.

Find more information in the class documentation


getDegree

public int getDegree(boolean countIsolatedEdges)

getIndegree

public int getIndegree(boolean countIsolatedEdges)

getOutdegree

public int getOutdegree(boolean countIsolatedEdges)

getHierarchicalDegree

public int getHierarchicalDegree(boolean countIsolatedEdges)

getHierarchicalIndegree

public int getHierarchicalIndegree(boolean countIsolatedEdges)

getHierarchicalOutdegree

public int getHierarchicalOutdegree(boolean countIsolatedEdges)

getAdjacentVisualEdges

public java.util.List getAdjacentVisualEdges()

getAdjacentVisualNodes

public java.util.List getAdjacentVisualNodes()

getInboundVisualEdges

public java.util.List getInboundVisualEdges()

getOutboundVisualEdges

public java.util.List getOutboundVisualEdges()

getInboundVisualNodes

public java.util.List getInboundVisualNodes()

getOutboundVisualNodes

public java.util.List getOutboundVisualNodes()

getVisualNodeInfo

public VisualNodeInfo getVisualNodeInfo()
Returns the VisualNodeInfo associated with this VisualNode.

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

Find more information in the class documentation


setVisualNodeInfo

public void setVisualNodeInfo(VisualNodeInfo visualNodeInfo)
Sets the VisualNodeInfo associated with this VisualNode.

Parameters:
visualNodeInfo - the VisualNodeInfo to associate with this VisualNode.

getVisualPortByID

public VisualPort getVisualPortByID(long id)
Returns the VisualPort that has the id given by id. If the VisualNode has no VisualPort with the given id null is returned.

Parameters:
id - the id of the VisualPort to return
Returns:
VisualPort the VisualPort specified through the given id or null

getVisualPortByName

public VisualPort getVisualPortByName(java.lang.String name)
Returns the VisualPort with the name given by name or null if no VisualPort was found.

Parameters:
name - the name of the VisualPort
Returns:
VisualPort the port or null

getVisualPorts

public java.util.List getVisualPorts()
Returns a list of the VisualPorts of this VisualNode.

Returns:
list of the visualports of this visualnode.

Find more information in the class documentation


setVisualPorts

public void setVisualPorts(java.util.List visualports)
Sets the List of visual ports given by ports as the new ports of this visual node.
This method is for internal use only and it is strongly recommended to not use it on client side.

Parameters:
visualports - the list of VisualPorts to use with this VisualNode

addVisualNodeListener

public void addVisualNodeListener(VisualNodeListener listener)
Adds a VisualNodeListener to this VisualNode.

Parameters:
listener - the VisualNodeListener to add to this VisualNode.

removeVisualNodeListener

public void removeVisualNodeListener(VisualNodeListener listener)
Removes a VisualNodeListener from this VisualNode.

Parameters:
listener - the VisualNodeListener to remove from this VisualNode.

reassignVisualPort

public VisualPort reassignVisualPort(int specifier,
                                     java.lang.Object[] args)
Returns the visual port that fits to the arguments given by args. The specifier determines what arguments are given. The following combinations are valid:
DEFAULT_PORT args[0] = the old port
DIRECTION_PORT args[0] = the old port args[1] = the degree to find the nearest port for

Parameters:
specifier - the specifier that determines what arguments are given
args - the arguments to find a new port for
Returns:
VisualPort

repositionVisualPorts

public void repositionVisualPorts()
Internally readjust ports with the standard names "CenterPort", "WestPort", "EastPort", "NorthPort", "CenterPort" to their home positions. Ports with other denotation-names are not processed.


adjustEdges

public void adjustEdges()
Updates all adjacent edgs which are registered at ports of this visualnode. The edge will snap in to their ports in case their positions differ from their attached positions.

Find more information in the class documentation


deepCopy

public VisualNode deepCopy(Node node)
Returns a deep copy of this visual node which is associated with the given node.

Parameters:
node - the node to associate the copied instance with.
Returns:
a deep copy of this instance.

deepCopyPorts

public void deepCopyPorts(VisualGraph visualgraph,
                          VisualNode visualnode,
                          Node node)
Performs a deep copy of the ports of this visualnode.

Parameters:
visualgraph - the visualgraph the source are associated with
visualnode - the visualnode to copy the ports from.
node - the deep copied node from the model.

internalResetVisualPortNumbers

public void internalResetVisualPortNumbers()
This method is for internal use only and should never be invoked by the client directly.



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