org.graffiti.plugins.algorithms.reingoldtilford
Enum Orientation

java.lang.Object
  extended by java.lang.Enum<Orientation>
      extended by org.graffiti.plugins.algorithms.reingoldtilford.Orientation
All Implemented Interfaces:
Serializable, Comparable<Orientation>

public enum Orientation
extends Enum<Orientation>

The orientation of a tree layout.

In all classes except ReingoldTilfordAlgorithm and Orientation, the tree is considered as growing from top to bottom, i.e. the root has the y-coordinate 0 and children have greater y-coordinates than their parents. In order to achieve different orientations, the coordinates and dimensions of the nodes, the edges and the ports are transformed by the respective descendants of Orientation. Therefore Tree and descendants of ChildOrderStrategy, EdgeLayoutStrategy and Levelling must not directly query or set coordinates or dimensions but rather use the methods ReingoldTilfordAlgorithm.getNodePosition(Node), ReingoldTilfordAlgorithm.getNodeDimension(Node), ReingoldTilfordAlgorithm.setNodePosition(Node, double, double), ReingoldTilfordAlgorithm.createPort(String, double, double) and ReingoldTilfordAlgorithm.createCoordinateAttribute(String, double, double).

Each orientation consists of a name and an OrientationStrategy that does the actual calculations.

To provide a new orientation, create a class extending OrientationStrategy and add a new member to this enumeration.

Version:
$Revision$ $Date$
Author:
Andreas Gleißner
See Also:
OrientationStrategy

Enum Constant Summary
BOTTOM_TO_TOP
          The root is at the bottom and the tree grows upwards.
LEFT_TO_RIGHT
          The root is at the left and the tree grows rightwards.
RIGHT_TO_LEFT
          The root is at the right and the tree grows leftwards.
TOP_TO_BOTTOM
          The root is at the top and the tree grows downwards.
 
Method Summary
 OrientationStrategy createOrientationStrategy()
          Creates a new instance of the subclass of OrientationStrategy employed by this enumeration member.
static List<String> getNames()
          Returns the names of the orientations.
static Orientation valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Orientation[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

TOP_TO_BOTTOM

public static final Orientation TOP_TO_BOTTOM
The root is at the top and the tree grows downwards.

See Also:
TopToBottomOrientation

LEFT_TO_RIGHT

public static final Orientation LEFT_TO_RIGHT
The root is at the left and the tree grows rightwards.

See Also:
LeftToRightOrientation

BOTTOM_TO_TOP

public static final Orientation BOTTOM_TO_TOP
The root is at the bottom and the tree grows upwards.

See Also:
BottomToTopOrientation

RIGHT_TO_LEFT

public static final Orientation RIGHT_TO_LEFT
The root is at the right and the tree grows leftwards.

See Also:
RightToLeftOrientation
Method Detail

values

public static Orientation[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Orientation c : Orientation.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Orientation valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getNames

public static List<String> getNames()
Returns the names of the orientations. To get the name of a specific orientation, such as TOP_TO_BOTTOM, you can write
Orientation.getNames().get( Orientation.TOP_TO_BOTTOM.ordinal())

Returns:
the names of the orientations.
See Also:
names

createOrientationStrategy

public OrientationStrategy createOrientationStrategy()
Creates a new instance of the subclass of OrientationStrategy employed by this enumeration member.

Returns:
a new instance of the subclass of OrientationStrategy employed by this enumeration member.


Generated at 2012-05-30 11:01:25 PM CEST