|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.ZTreeLayoutManager
ZTreeLayoutManager implements a generic tree layout manager that can layout hierarchical Jazz objects, ie. a scenegraph. This layout does not give each child subtree in the scenegraph enough room for the bounding box of the entire subtree, rather it tries to minimize the total space used while maintaining no overlap among child subtrees.
Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.
Field Summary | |
protected java.util.Hashtable |
areaManager
A hashtable to store the areas for nodes using this manager. |
protected int |
currentHeadStyle
The Current Heading Style. |
protected int |
currentLinkStyle
The Current Link Style. |
protected static int |
currentOrientation
The Current Orientation. |
protected double |
currentXSpacing
The Current X Spacing. |
protected double |
currentYSpacing
The Current Y Spacing. |
protected static double |
DEFAULT_SPACING
The Default Spacing. |
static int |
HEAD_IN
Heading style that puts current node at the middle of its immediate children |
static int |
HEAD_OUT
Heading style that puts current node at the middle of all its children |
static int |
HEAD_SIDE
Heading style that puts current node at one side of all its children (ie. |
static int |
LINK_ANGLEDLINE
This option connects parent nodes to child nodes with vertical and horizontal lines only |
static int |
LINK_STRAIGHTLINE
This option connects parent nodes to child nodes with a straight line |
protected boolean |
linkVisible
Are links visible? |
static int |
ORIENT_HORIZONTAL
Horizontal Tree Layout - a left to right layout |
static int |
ORIENT_VERTICAL
Vertical Tree Layout - a top to bottom layout |
protected static java.awt.geom.Point2D |
ORIGIN
A Permanent holder for an Origin point. |
protected int |
recurseLevel
The current level of recursion in this layout manager. |
protected java.util.ArrayList |
transformNodes
A hashtable to store nodes that need transforming in the current set of recursive calls to doLayout. |
protected java.util.Hashtable |
transformTable
A hashtable to store the transforms for nodes in the current set of recursive calls to doLayout |
Constructor Summary | |
ZTreeLayoutManager()
The default constructor - uses all default values |
|
ZTreeLayoutManager(int orientation,
int headingStyle,
boolean showLink,
int linkStyle)
Fully qualified constructor |
Method Summary | |
protected void |
calculateChildrenLayout(ZGroup aPrimaryGroup)
Appropriately Lays out the children of the provided node |
java.lang.Object |
clone()
Return a clone of this object. |
protected void |
computeNodeArea(ZNode aPrimaryNode)
Computes the given nodes area - this includes the bounds of its visual component and the stored areas for its immediate children |
protected java.awt.geom.Point2D |
computeOverlap(java.awt.geom.Area a,
java.awt.geom.Area b)
Returns the overlap of the two given areas |
void |
doLayout(ZGroup aLayoutGroup)
Method from the ZLayoutManager interface Called to layout the layout group |
void |
doLayout(ZGroup node,
int millis)
Apply this manager's layout algorithm to the specified node's children, and animate the changes over time. |
int |
getCurrentHeadStyle()
Get the current heading style |
int |
getCurrentOrientation()
Get the current orientation. |
double |
getCurrentXSpacing()
Get the current x spacing |
double |
getCurrentYSpacing()
Get the current y spacing |
protected ZBounds |
getFrontVisualComponentBounds(ZNode aVisualNode)
Convenience method to get the bounds of the front visual component of the given node |
int |
getLinkStyle()
Get the value of linkStyle. |
protected java.awt.geom.Area |
getNodeArea(ZNode aPrimaryNode)
Gets the stored area for the given node |
protected ZBounds |
padBounds(ZBounds bounds)
Convenience method to pad the given bounds with the current spacing |
void |
postLayout(ZGroup aLayoutGroup)
Method from the ZLayoutManager interface Called after doLayout |
void |
preLayout(ZGroup aLayoutGroup)
Method from the ZLayoutManager interface Called before doLayout |
protected void |
resetTransformVariables()
Resets the transformTable and the transformNodes |
boolean |
setCurrentHeadingStyle(ZLayoutGroup layout,
int h)
Set the current heading style. |
boolean |
setCurrentOrientation(ZLayoutGroup layout,
int orientation)
Set the current orientation. |
boolean |
setCurrentXSpacing(double x)
Set the current vertical spacing. |
boolean |
setCurrentYSpacing(double y)
Set the current horizontal spacing. |
protected java.awt.geom.Point2D |
setDestinationPoint(ZNode aPrimaryNode,
java.awt.geom.Point2D dest)
Sets the bounds location for the given node to the specified point. |
boolean |
setLinkStyle(ZLayoutGroup layout,
int v)
Set the value of linkStyle. |
void |
setState(java.lang.String fieldType,
java.lang.String fieldName,
java.lang.Object fieldValue)
Set some state of this object as it gets read back in. |
protected void |
translateDestinationPoint(ZNode aPrimaryNode,
java.awt.geom.Point2D trans)
Translates the transform corresponding to the given node in the transformTable. |
protected java.awt.geom.Area |
updateChildArea(ZNode aPrimaryNode,
java.awt.geom.Point2D trans)
Translates the child nodes area, potentially stored in the area manager, by the specified translation |
protected static void |
updateInvalidLinks(ZNode top)
Updates all links, in depth-first order, below the supplied ZNode |
protected void |
updateTree()
Actually transforms all nodes that have a stored transform in the transformTable |
void |
writeObject(ZObjectOutputStream out)
Write out all of this object's state. |
void |
writeObjectRecurse(ZObjectOutputStream out)
Specify which objects this object references in order to write out the scenegraph properly |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ORIENT_VERTICAL
public static final int ORIENT_HORIZONTAL
public static final int HEAD_IN
public static final int HEAD_OUT
public static final int HEAD_SIDE
public static final int LINK_STRAIGHTLINE
public static final int LINK_ANGLEDLINE
protected static double DEFAULT_SPACING
protected static final java.awt.geom.Point2D ORIGIN
protected int currentHeadStyle
protected static int currentOrientation
protected double currentXSpacing
protected double currentYSpacing
protected int currentLinkStyle
protected boolean linkVisible
protected java.util.Hashtable areaManager
protected java.util.Hashtable transformTable
protected java.util.ArrayList transformNodes
protected int recurseLevel
Constructor Detail |
public ZTreeLayoutManager()
public ZTreeLayoutManager(int orientation, int headingStyle, boolean showLink, int linkStyle)
orientation
- The desired tree layout orientation - ORIENT_VERTICAL or ORIENT_HORIZONTALheadingStyle
- The desired head style - HEAD_IN, HEAD_OUT, or HEAD_SIDEshowLink
- Should links be displayedlinkStyle
- If links are displayed, the style of links - LINK_STRAIGHTLINE or LINK_ANGLEDLINEMethod Detail |
public java.lang.Object clone()
clone
in interface ZLayoutManager
clone
in class java.lang.Object
public boolean setCurrentOrientation(ZLayoutGroup layout, int orientation)
orientation
- the desired orientation - ORIENT_VERTICAL or ORIENT_HORIZONTALtrue
if orientation
set, false
if orientation
not supported.public int getCurrentOrientation()
public boolean setCurrentHeadingStyle(ZLayoutGroup layout, int h)
h
- the desired heading style - HEAD_IN, HEAD_OUT, or HEAD_SIDEtrue
if set successfuly, false
otherwisepublic int getCurrentHeadStyle()
public boolean setCurrentXSpacing(double x)
x
- the value for x spacing -- horizontal spacingtrue
if set successfuly, false
otherwisepublic boolean setCurrentYSpacing(double y)
y
- the value for y spacing -- horizontal spacingtrue
if set successfuly, false
otherwisepublic double getCurrentXSpacing()
public double getCurrentYSpacing()
public int getLinkStyle()
public boolean setLinkStyle(ZLayoutGroup layout, int v)
v
- Value to assign to linkStyle - LINK_STRAIGHTLINE or LINK_ANGLEDLINEtrue
if set successfulypublic void preLayout(ZGroup aLayoutGroup)
preLayout
in interface ZLayoutManager
aLayoutGroup
- The layout group currently under considerationpublic void doLayout(ZGroup node, int millis)
doLayout
in interface ZLayoutManager
node
- The node to apply this layout algorithm to.millis
- The number of milliseconds over which to animate layout changes.public void doLayout(ZGroup aLayoutGroup)
doLayout
in interface ZLayoutManager
aLayoutGroup
- The layout group currently under considerationpublic void postLayout(ZGroup aLayoutGroup)
postLayout
in interface ZLayoutManager
aLayoutGroup
- The layout group currently under considerationprotected void calculateChildrenLayout(ZGroup aPrimaryGroup)
aPrimaryGroup
- The primary group for which the children should be laid outprotected void updateTree()
protected void translateDestinationPoint(ZNode aPrimaryNode, java.awt.geom.Point2D trans)
aPrimaryNode
- the primary node to transformtrans
- the amount to translateprotected java.awt.geom.Point2D setDestinationPoint(ZNode aPrimaryNode, java.awt.geom.Point2D dest)
aPrimaryNode
- the primary node to transformtrans
- the amount to translatedest
protected java.awt.geom.Area updateChildArea(ZNode aPrimaryNode, java.awt.geom.Point2D trans)
aPrimaryNode
- the primary child node whose area is to be updatedtrans
- the translation by which the area is to be updatedprotected void computeNodeArea(ZNode aPrimaryNode)
aPrimaryNode
- the node for which the area is computedprotected java.awt.geom.Area getNodeArea(ZNode aPrimaryNode) throws java.util.ConcurrentModificationException
aPrimaryNode
- The node for which the area is desiredprotected ZBounds getFrontVisualComponentBounds(ZNode aVisualNode)
aVisualNode
- The node for which the visual component bounds are desiredprotected ZBounds padBounds(ZBounds bounds)
bounds
- the bounds to be paddedprotected java.awt.geom.Point2D computeOverlap(java.awt.geom.Area a, java.awt.geom.Area b)
a
- one area for which overlap is computedb
- one area for which overlap is computedprotected void resetTransformVariables()
protected static void updateInvalidLinks(ZNode top)
top
- The node below which all links should be updatedpublic void writeObject(ZObjectOutputStream out) throws java.io.IOException
writeObject
in interface ZSerializable
out
- The stream that this object writes intopublic void writeObjectRecurse(ZObjectOutputStream out) throws java.io.IOException
writeObjectRecurse
in interface ZSerializable
out
- The stream that this object writes intopublic void setState(java.lang.String fieldType, java.lang.String fieldName, java.lang.Object fieldValue)
setState
in interface ZSerializable
fieldType
- The fully qualified type of the fieldfieldName
- The name of the fieldfieldValue
- The value of the field
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |