com.tensegrity.graph.layout
Interface LayoutableEdge

All Superinterfaces:
Layoutable
All Known Subinterfaces:
VisualEdge

public interface LayoutableEdge
extends Layoutable

This is the general interface for any edge which should be arranged by a Layout. It specifies a contract with the Layout interface by providing methods that allow client code to retrieve, remove and insert coordinate points. Moreover, edge type, marker, port and label data is exposed by this interface.

Version:
$Id: LayoutableEdge.java,v 1.48 2006/01/25 22:09:12 SharokhKhani Exp $
Author:
Sharokh Khani

Field Summary
static int EDGE_TYPE_CURVE
          Edge type specifier.
static int EDGE_TYPE_DYNAMIC
          Edge type specifier.
static int EDGE_TYPE_ORTHOGONAL
          Edge type specifier.
static int EDGE_TYPE_STRAIGHT
          Edge type specifier.
static int LABEL_POSITION_CENTER
          Label position specifier.
static int LABEL_POSITION_CENTER_END
          Label position specifier.
static int LABEL_POSITION_CENTER_START
          Label position specifier.
static int LABEL_POSITION_FREE
          Label position specifier.
static int LABEL_POSITION_HEAD
          Label position specifier.
static int LABEL_POSITION_HEAD_END
          Label position specifier.
static int LABEL_POSITION_HEAD_START
          Label position specifier.
static int LABEL_POSITION_TAIL
          Label position specifier.
static int LABEL_POSITION_TAIL_END
          Label position specifier.
static int LABEL_POSITION_TAIL_START
          Label position specifier.
 
Method Summary
 Coordinate getCoordinateAt(int index)
          Returns the Coordinate of the edge point at the index specified by index.
 int getCoordinateCount()
          Returns the current number of Coordinates of which this edge consist.
 Coordinate[] getCoordinates()
          Returns the list of the current Coordinates of which this edge consist.
 LayoutableNode getInnerSourceNode()
          Gets the LayoutableNode at the source end of this LayoutableEdge.
 LayoutableNode getInnerTargetNode()
          Gets the LayoutableNode at the target end of this LayoutableEdge.
 int getLabelAnchor()
          Returns the anchor of the label's position of this edge.
 Coordinate getLabelLocation()
          Returns the location of the label
 int getLabelPlacement()
          Returns the placement of the label of this edge.
 int getLabelPositioning()
          Returns the positioning of the label of this edge.
 Size getLabelSize()
          Returns the size of the label.
 int getMarkerBeginSize()
          Returns the size of the marker at the begin of the edge.
 int getMarkerEndSize()
          Returns the size of the marker at the end of the edge.
 LayoutableNode getSourceNode()
          Gets the LayoutableNode at the source end of this LayoutableEdge.
 long getSourcePortId()
          Returns the identifier of the port at the source node
 LayoutableNode getTargetNode()
          Gets the LayoutableNode at the target end of this LayoutableEdge.
 long getTargetPortId()
          Returns the identifier of the port at the target node
 int getType()
          Returns the type of the edge.
 boolean hasLabel()
          Indicates whether this edge has a label
 void insertCoordinate(int index, Coordinate coordinate)
          Inserts the Coordinate given by coordinate at the index given by index.
 void insertCoordinate(int index, Coordinate coordinate, Coordinate[] refCoordinate)
          Inserts the Coordinate given by coordinate at the index given by index.
 boolean isDetached()
          Indicates whether the edge is detached..
 void layoutLabel(Coordinate location)
          Set the position of the label of this edge to the given Coordinate.
 boolean reassignSourcePortByID(long nodePortID)
          Reassigns the source end of a edge to the desired port
 boolean reassignSourcePortByPredicate(VisualPortAssignmentPredicate predicate)
          Reassigns the source end of the edge according of the specified VisualPortAssignmentPredicate.
 Coordinate reassignSourceToPortByAngle(double angle)
          Reassigns the source end of the edge to the next reachable port using the given angle
 boolean reassignTargetPortByID(long nodePortID)
          Reassigns the target end of a edge to the desired port
 boolean reassignTargetPortByPredicate(VisualPortAssignmentPredicate predicate)
          Reassigns the target end of the edge according of the specified VisualPortAssignmentPredicate.
 Coordinate reassignTargetToPortByAngle(double angle)
          Reassigns the target end of the edge to the next reachable port using the given angle
 void reassignToNextPort()
          Reassigns this edge to the next ports at the source and target node according to the angle between the center of the source node and the center of the target node.
 void removeCoordinate(int index)
          Removes the Coordinate at the index given by index from the CompositeLines coordinates.
 void removeCoordinates(int index1, int index2)
          Removes all Coordinates between the two indices given by index1 and index2 from the CompositeLines actual Coordinates.
 void setCoordinateAt(int index, Coordinate coordinate)
          Sets the Coordinate given by coordinate at the index given by index of the edge current coordinates.
 void setCoordinates(Coordinate[] coordinates)
          Uses the new points specified by coordinates.
 void setType(int type)
          Sets the type of the edge.
 
Methods inherited from interface com.tensegrity.graph.layout.Layoutable
getEdgeLayoutContext, getLayoutAttributeSet, getLayoutContext, getNodeLayoutContext, getUniqueID, setEdgeLayoutContext, setLayoutAttributes, setLayoutContext, setNodeLayoutContext
 

Field Detail

LABEL_POSITION_FREE

public static final int LABEL_POSITION_FREE
Label position specifier. The position of the node can be set by layout class

See Also:
Constant Field Values

LABEL_POSITION_HEAD

public static final int LABEL_POSITION_HEAD
Label position specifier. The label is above/left the middle segment

See Also:
Constant Field Values

LABEL_POSITION_HEAD_START

public static final int LABEL_POSITION_HEAD_START
Label position specifier. The label is above/left the first segment

See Also:
Constant Field Values

LABEL_POSITION_HEAD_END

public static final int LABEL_POSITION_HEAD_END
Label position specifier. The label is above/left the last segment

See Also:
Constant Field Values

LABEL_POSITION_TAIL

public static final int LABEL_POSITION_TAIL
Label position specifier. The label is under/right the middle segment

See Also:
Constant Field Values

LABEL_POSITION_TAIL_START

public static final int LABEL_POSITION_TAIL_START
Label position specifier. The label is under/right the first segment

See Also:
Constant Field Values

LABEL_POSITION_TAIL_END

public static final int LABEL_POSITION_TAIL_END
Label position specifier. The label is under/right the last segment

See Also:
Constant Field Values

LABEL_POSITION_CENTER

public static final int LABEL_POSITION_CENTER
Label position specifier. The label is centered on the middle segment

See Also:
Constant Field Values

LABEL_POSITION_CENTER_START

public static final int LABEL_POSITION_CENTER_START
Label position specifier. The label is centered on the first segment

See Also:
Constant Field Values

LABEL_POSITION_CENTER_END

public static final int LABEL_POSITION_CENTER_END
Label position specifier. The label is centered on the last segment

See Also:
Constant Field Values

EDGE_TYPE_DYNAMIC

public static final int EDGE_TYPE_DYNAMIC
Edge type specifier. The type of the edge can be set by layout classes

See Also:
Constant Field Values

EDGE_TYPE_STRAIGHT

public static final int EDGE_TYPE_STRAIGHT
Edge type specifier.

See Also:
Constant Field Values

EDGE_TYPE_ORTHOGONAL

public static final int EDGE_TYPE_ORTHOGONAL
Edge type specifier.

See Also:
Constant Field Values

EDGE_TYPE_CURVE

public static final int EDGE_TYPE_CURVE
Edge type specifier.

See Also:
Constant Field Values
Method Detail

getSourceNode

public LayoutableNode getSourceNode()
Gets the LayoutableNode at the source end of this LayoutableEdge.

Returns:
the LayoutableNode at the start of this LayoutableEdge.

Find more information in the class documentation


getTargetNode

public LayoutableNode getTargetNode()
Gets the LayoutableNode at the target end of this LayoutableEdge.

Returns:
the LayoutableNode at the end of this LayoutableEdge.

Find more information in the class documentation


getInnerSourceNode

public LayoutableNode getInnerSourceNode()
Gets the LayoutableNode at the source end of this LayoutableEdge.

Returns:
the LayoutableNode at the start of this LayoutableEdge.

getInnerTargetNode

public LayoutableNode getInnerTargetNode()
Gets the LayoutableNode at the target end of this LayoutableEdge.

Returns:
the LayoutableNode at the end of this LayoutableEdge.

getCoordinates

public Coordinate[] getCoordinates()
Returns the list of the current Coordinates of which this edge consist.

Returns:
Coordinate[] the Coordinates that this edge currently consists of.

Find more information in the class documentation


setCoordinates

public void setCoordinates(Coordinate[] coordinates)
Uses the new points specified by coordinates. The old points will be removed and the edge will be consist of the given Coordinates

Parameters:
coordinates - the new Coordinates for the edge.

Find more information in the class documentation


getCoordinateCount

public int getCoordinateCount()
Returns the current number of Coordinates of which this edge consist.

Returns:
int the current count of coordinates

Find more information in the class documentation


getCoordinateAt

public Coordinate getCoordinateAt(int index)
Returns the Coordinate of the edge point at the index specified by index. If the index is less than zero or larger than the actual count of Coordinates an exception will be thrown.

Parameters:
index - the index of the Coordinate to return
Returns:
Coordinate the Coordinate at the given index

Find more information in the class documentation


setCoordinateAt

public void setCoordinateAt(int index,
                            Coordinate coordinate)
Sets the Coordinate given by coordinate at the index given by index of the edge current coordinates. If the index is less than zero or larger than the actual count of Coordinates an exception will be thrown.

Parameters:
index - where to set the given Coordinate to
coordinate - the Coordinate to set

Find more information in the class documentation


insertCoordinate

public void insertCoordinate(int index,
                             Coordinate coordinate)
Inserts the Coordinate given by coordinate at the index given by index. If the first index is less than zero it is adjusted to zero. If the second index is larger than the actual count of Coordinates it is adjusted to the actual count of Coordinates

Parameters:
index - the index where to insert the Coordinate
coordinate - the Coordinate to insert

Find more information in the class documentation


insertCoordinate

public void insertCoordinate(int index,
                             Coordinate coordinate,
                             Coordinate[] refCoordinate)
Inserts the Coordinate given by coordinate at the index given by index. If the first index is less than zero it is adjusted to zero. If the second index is larger than the actual count of Coordinates it is adjusted to the actual count of Coordinates

Parameters:
index - the index where to insert the Coordinate
coordinate - the Coordinate to insert
refCoordinate - the reference Coordinates to insert

Find more information in the class documentation


removeCoordinate

public void removeCoordinate(int index)
Removes the Coordinate at the index given by index from the CompositeLines coordinates. If the index is less than zero or larger than the actual count of Coordinates an exception will be thrown.

Parameters:
index - the index of the Coordinate to remove

Find more information in the class documentation


removeCoordinates

public void removeCoordinates(int index1,
                              int index2)
Removes all Coordinates between the two indices given by index1 and index2 from the CompositeLines actual Coordinates. If the first index is less than zero it is adjusted to zero. If the second index is larger than the actual count of Coordinates it is adjusted to the actual count of Coordinates

Parameters:
index1 - the index of the first Coordinate to remove
index2 - the index of the last Coordinate to remove

Find more information in the class documentation


getType

public int getType()
Returns the type of the edge. An edge layout has to take this into consideration.

Returns:
type of the edge

setType

public void setType(int type)
Sets the type of the edge. Valid values are

Parameters:
type - the type to set.

getSourcePortId

public long getSourcePortId()
Returns the identifier of the port at the source node

Returns:
the id of the node at the source node if any, otherwise -1

Find more information in the class documentation


getTargetPortId

public long getTargetPortId()
Returns the identifier of the port at the target node

Returns:
the id of the node at the target node if any, otherwise -1

Find more information in the class documentation


reassignSourcePortByID

public boolean reassignSourcePortByID(long nodePortID)
Reassigns the source end of a edge to the desired port

Parameters:
nodePortID - the new port id of the source node
Returns:
true if the reassign successes, otherwise false.

Find more information in the class documentation


reassignTargetPortByID

public boolean reassignTargetPortByID(long nodePortID)
Reassigns the target end of a edge to the desired port

Parameters:
nodePortID - the new port id of the source node
Returns:
true if the reassign successes, otherwise false.

Find more information in the class documentation


reassignSourcePortByPredicate

public boolean reassignSourcePortByPredicate(VisualPortAssignmentPredicate predicate)
Reassigns the source end of the edge according of the specified VisualPortAssignmentPredicate.

Parameters:
predicate - the predicate that is to be used.
Returns:
true if the reassign successes, otherwise false.

Find more information in the class documentation


reassignTargetPortByPredicate

public boolean reassignTargetPortByPredicate(VisualPortAssignmentPredicate predicate)
Reassigns the target end of the edge according of the specified VisualPortAssignmentPredicate.

Parameters:
predicate - the predicate that is to be used.
Returns:
true if the reassign successes, otherwise false.

Find more information in the class documentation


reassignSourceToPortByAngle

public Coordinate reassignSourceToPortByAngle(double angle)
Reassigns the source end of the edge to the next reachable port using the given angle

Parameters:
angle - the angle to reference point
Returns:
the Coordinate of the specified port.

Find more information in the class documentation


reassignTargetToPortByAngle

public Coordinate reassignTargetToPortByAngle(double angle)
Reassigns the target end of the edge to the next reachable port using the given angle

Parameters:
angle - the angle to reference point
Returns:
the Coordinate of specified port.

Find more information in the class documentation


reassignToNextPort

public void reassignToNextPort()
Reassigns this edge to the next ports at the source and target node according to the angle between the center of the source node and the center of the target node.

Find more information in the class documentation


isDetached

public boolean isDetached()
Indicates whether the edge 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.

Returns:
true if this edge has been manipulated so that it is detached.

getLabelPositioning

public int getLabelPositioning()
Returns the positioning of the label of this edge.

Returns:
the positioning of the label of this edge.

Find more information in the class documentation


getLabelAnchor

public int getLabelAnchor()
Returns the anchor of the label's position of this edge.

Returns:
the anchor of the label's position of this edge.

Find more information in the class documentation


getLabelPlacement

public int getLabelPlacement()
Returns the placement of the label of this edge.

Returns:
the placement of the label of this edge.

Find more information in the class documentation


layoutLabel

public void layoutLabel(Coordinate location)
Set the position of the label of this edge to the given Coordinate.

Parameters:
location - the new position of the top/left corner of the lable.

Find more information in the class documentation


hasLabel

public boolean hasLabel()
Indicates whether this edge has a label

Returns:
true if the edge has a label, otherwise false.

Find more information in the class documentation


getLabelSize

public Size getLabelSize()
Returns the size of the label.

Returns:
the size of the label

Find more information in the class documentation


getLabelLocation

public Coordinate getLabelLocation()
Returns the location of the label

Returns:
the location of the label

Find more information in the class documentation


getMarkerBeginSize

public int getMarkerBeginSize()
Returns the size of the marker at the begin of the edge.

Returns:
int the marker length.

getMarkerEndSize

public int getMarkerEndSize()
Returns the size of the marker at the end of the edge.

Returns:
int the marker length.


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