com.tensegrity.graph.view
Interface VisualPort

All Superinterfaces:
PunctualGeometryItem

public interface VisualPort
extends PunctualGeometryItem

This interface represents the visualization of a model Port that is contained and managed by a VisualNode.

This interface defines the characteristics of a single visual connection point to a VisualNode from which a VisualEdge instance is attached. In other words, an VisualEdge connects to a VisualNode via one of the many VisualPort instances owned and managed by a VisualNode, and not to the VisualNode directly.

A VisualPort uses a so-called VisualPortDenotation, which defines the angular interval where incoming and outgoing edges are allowed to connect to the associated VisualPort.

Visual ports have identifiers which can be returned to clients who request them.

The identifiers of a VisualPort and its associated model object always correspond and are unique within a single Graph, VisualGraph, Subgraph and VisualSubgraph. These identifiers are set to -1 when no longer contained by a parent component.

Each active VisualPort managed by a single VisualNode instance can be retrieved by invoking the method getVisualNode().

The number of VisualEdge objects that are currently connected to a VisualPort can be retrieved by invoking the method getRegisteredVisualEdgeCount(). The actual VisualEdge objects that are connected can be retrieved by invoking getRegisteredVisualEdges().

A VisualPort can have a number of different drawing states which are defined by the constants prefixed with DRAWINGSTATE_ and which can be set by invoking the method setDrawingState(int). This method is invoked internally by the library and usually there should not be any to need to invoke this method manually.

A VisualPort can either be direct (a so-called leaf-port) or indirect (a so-called wrapped-port). From the perspective of a library user, the difference is not significant. Wrapped-ports can themselves be wrapped up recursively. The method getDepth() can be used to find out the depth of nesting. The VisualNode that holds the leaf-port (the port that doesn't wrap-up other ports) can be queried by invoking the method getWrappedVisualNode().

The methods getCoordinate() and getBoundingBoxCoordinate() are used to find out the geometric position of a VisualPort. The later method returns the position in the CoordinateSystem of the enclosing VisualNode and thus is the one that is likely to be used in most cases.

Version:
$Id: VisualPort.java,v 1.46 2006/03/21 14:30:41 MichaelKegel Exp $
Author:
MichaelKegel, S. Rutz
See Also:
VisualNode, VisualEdge, Coordinate, VisualPortDenotation, Port, PortDenotation

Field Summary
static int DRAWINGSTATE_FORBIDDEN
          The drawing states for a VisualPort.
static int DRAWINGSTATE_FREE
          The drawing states for a VisualPort.
static int DRAWINGSTATE_HIT
          The drawing states for a VisualPort.
static int DRAWINGSTATE_NONE
          The drawing states for a VisualPort.
 
Method Summary
 VisualPort deepCopy(VisualNode visualnode, VisualGraph visualgraph, Port port)
          Makes a deep independent copy of this VisualPort.
 Coordinate getBoundingBoxCoordinate()
          Returns the Coordinate of this VisualPort.
 Composite getComposite()
          Returns the Composite this VisualPort uses for its visual representation.
 Coordinate getCoordinate()
          Returns the Coordinate of this VisualPort.
 VisualNode getDeepestVisualNode()
          Notice:API internal method.
 VisualPort getDeepestVisualPort()
          Notice:API internal method.
 int getDegree(boolean countIsolatedEdges)
           
 VisualPortDenotation getDenotation()
          Returns the VisualPortDenotation of this VisualPort.
 int getDepth()
          Returns the wrapping depth of this VisualPort.
 int getDrawingState()
          Drawing state, will trigger a different visualization for example when the port has a rule that forbids further attachments, when the port is hit or when the port is free for further attachments.
 int getHierarchicalDegree(boolean countIsolatedEdges)
           
 int getHierarchicalIndegree(boolean countIsolatedEdges)
           
 int getHierarchicalOutdegree(boolean countIsolatedEdges)
           
 long getID()
          Returns the id of this VisualPort.
 int getIndegree(boolean countIsolatedEdges)
           
 int getOutdegree(boolean countIsolatedEdges)
           
 Port getPort()
          Returns the associated Port from the graph model.
 int getRegisteredVisualEdgeCount()
          Returns the count of the registered VisualEdge objects of this VisualPort.
 java.util.List getRegisteredVisualEdges()
          Returns a list of the registered VisualEdges of this VisualPort.
 VisualNode getVisualNode()
          Returns the associated VisualNode of this VisualPort.
 VisualNode getWrappedVisualNode()
          Notice:API internal method.
 VisualPort getWrappedVisualPort()
          Notice:API internal method.
 boolean isRegistered(VisualEdge visualedge)
          Checks whether the given VisualEdge is registered at this port.
 boolean pointsToVisualNode(VisualNode visualnode)
          Returns true if this instance points to the given VisualNode directly or indirectly.
 boolean pointsToVisualPort(VisualPort visualport)
          Returns true if this instance points to the given VisualPort directly or indirectly.
 void setDrawingState(int drawingstate)
          Sets the drawing state for this VisualPort.
 
Methods inherited from interface com.tensegrity.composite.geometry.PunctualGeometryItem
addGeometryValue, getGeometryValue, hasGeometryValue, setCoordinate
 

Field Detail

DRAWINGSTATE_NONE

public static final int DRAWINGSTATE_NONE
The drawing states for a VisualPort.

See Also:
Constant Field Values

DRAWINGSTATE_FREE

public static final int DRAWINGSTATE_FREE
The drawing states for a VisualPort.

See Also:
Constant Field Values

DRAWINGSTATE_FORBIDDEN

public static final int DRAWINGSTATE_FORBIDDEN
The drawing states for a VisualPort.

See Also:
Constant Field Values

DRAWINGSTATE_HIT

public static final int DRAWINGSTATE_HIT
The drawing states for a VisualPort.

See Also:
Constant Field Values
Method Detail

getID

public long getID()
Returns the id of this VisualPort.

Returns:
the id of this VisualPort.

getDenotation

public VisualPortDenotation getDenotation()
Returns the VisualPortDenotation of this VisualPort.

Returns:
the VisualPortDenotation of this VisualPort.
See Also:
VisualPortDenotation

getPort

public Port getPort()
Returns the associated Port from the graph model.

Returns:
associated port from the graph model.

getVisualNode

public VisualNode getVisualNode()
Returns the associated VisualNode of this VisualPort.

Returns:
the associated VisualNode of this VisualPort.

getCoordinate

public Coordinate getCoordinate()
Returns the Coordinate of this VisualPort. The coordinate is returned in the CoordinateSystem of the VisualNode this port belongs to.

Specified by:
getCoordinate in interface PunctualGeometryItem
Returns:
Coordinate the coordinate of this VisualPort.
See Also:
Coordinate

getBoundingBoxCoordinate

public Coordinate getBoundingBoxCoordinate()
Returns the Coordinate of this VisualPort. The coordinate is returned in the CoordinateSystem the BoundingBox of the VisualNode this port belongs to.

Returns:
Coordinate the coordinate of this VisualPort.
See Also:
Coordinate

getComposite

public Composite getComposite()
Returns the Composite this VisualPort uses for its visual representation.

Returns:
the Composite of this VisualPort.

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)

isRegistered

public boolean isRegistered(VisualEdge visualedge)
Checks whether the given VisualEdge is registered at this port.

Parameters:
visualedge - check this VisualEdge for registration.
Returns:
true if the VisualEdge is already registered at this instance.
See Also:
VisualEdge

getRegisteredVisualEdges

public java.util.List getRegisteredVisualEdges()
Returns a list of the registered VisualEdges of this VisualPort.

Returns:
list of the registered VisualEdges of this VisualPort.
See Also:
VisualEdge

getRegisteredVisualEdgeCount

public int getRegisteredVisualEdgeCount()
Returns the count of the registered VisualEdge objects of this VisualPort.

Returns:
count of the registered VisualEdge objects of this VisualPort.
See Also:
VisualEdge

getDrawingState

public int getDrawingState()
Drawing state, will trigger a different visualization for example when the port has a rule that forbids further attachments, when the port is hit or when the port is free for further attachments.

Returns:
the drawing state for this VisualPort. The returned value is one of the DRAWING-STATE constants defined in this interface.

setDrawingState

public void setDrawingState(int drawingstate)
Sets the drawing state for this VisualPort. The value is one of the DRAWING-STATE constants defined in this interface.

Parameters:
drawingstate - the drawing state for this port.

getWrappedVisualPort

public VisualPort getWrappedVisualPort()
Notice:API internal method. Clients must never call this method.
Returns the VisualPort that this instance is pointing to indirectly. If this instance of the VisualPort doesn't points indirectly to another VisualPort this method returns null.

Returns:
the VisualPort that this instance is pointing to indirectly or null

getWrappedVisualNode

public VisualNode getWrappedVisualNode()
Notice:API internal method. Clients must never call this method.
Returns the VisualNode that this instance is pointing to indirectly. If this instance of the VisualPort doesn't points indirectly to another VisualNode this method returns null.

Returns:
the VisualNode that this instance is pointing to indirectly or null

pointsToVisualPort

public boolean pointsToVisualPort(VisualPort visualport)
Returns true if this instance points to the given VisualPort directly or indirectly.

Parameters:
visualport - the VisualPort to look for downwards in the hierarchy.
Returns:
true if this instance points to the specified VisualPort.

pointsToVisualNode

public boolean pointsToVisualNode(VisualNode visualnode)
Returns true if this instance points to the given VisualNode directly or indirectly.

Parameters:
visualnode - the VisualNode to look for downwards in the hierarchy.
Returns:
true if this instance points to the specified VisualNode.

getDepth

public int getDepth()
Returns the wrapping depth of this VisualPort.

Returns:
the wrapping depth of this VisualPort.

getDeepestVisualPort

public VisualPort getDeepestVisualPort()
Notice:API internal method. Clients must never call this method.
Returns the deepest VisualPort that this instance is pointing to. If this instance of the VisualPort doesn't points to another VisualPort this method returns this instance.

Returns:
the deepest VisualNode that this instance is pointing to indirectly

getDeepestVisualNode

public VisualNode getDeepestVisualNode()
Notice:API internal method. Clients must never call this method.
Returns the deepest VisualNode that this instance is pointing to indirectly. If this instance of the VisualPort doesn't points indirectly to another VisualNode this method returns the VisualNode this instance is pointing to.

Returns:
the deepest VisualNode that this instance is pointing to directly or indirectly

deepCopy

public VisualPort deepCopy(VisualNode visualnode,
                           VisualGraph visualgraph,
                           Port port)
Makes a deep independent copy of this VisualPort.

Parameters:
visualnode - the associated VisualNode.
visualgraph - the VisualGraph that is being operated in.
port - reference to the model's Port the copy is to be associated with.
Returns:
a deep copy of this VisualPort.
See Also:
VisualGraph, VisualNode, Port


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