edu.umd.cs.jazz
Class ZPathLayoutManager

java.lang.Object
  |
  +--edu.umd.cs.jazz.ZPathLayoutManager
All Implemented Interfaces:
ZLayoutManager, ZSerializable

public class ZPathLayoutManager
extends java.lang.Object
implements ZLayoutManager, ZSerializable

ZPathLayoutManager positions a set of nodes along a path.

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.

Author:
Lance Good
, Benjamin B. Bederson
See Also:
ZNode, ZLayout

Constructor Summary
ZPathLayoutManager()
          Default Constructor - uses default values unless specifically set
ZPathLayoutManager(java.awt.Shape s)
          Constructor that accepts a shape
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this layout manager.
 void doLayout(ZGroup node)
          Apply this manager's layout algorithm to the specified node's children.
 void doLayout(ZGroup node, int millis)
          Apply this manager's layout algorithm to the specified node's children, and animate the changes over time.
 boolean getClosed()
          Determine whether the path is closed.
 boolean getExact()
          Determine if exact spacing was specified.
 double getFlatness()
          Return the current flatness of the FlatteningPathIterator used to convert the Shape to points.
 boolean getInvertChildren()
          Gets whether this layout manager inverts its children before laying them out.
 java.awt.Shape getShape()
          Get the shape currently in use by this object.
 double getSpace()
          The current spacing used by the layout algorithm during its first iteration.
 double getTolerance()
          Get the tolerance allowed if exact spacing is specified.
 void postLayout(ZGroup node)
          Notify the layout manager that the layout for this node has finished This is called after all children and the node itself are layed out.
 void preLayout(ZGroup node)
          Notify the layout manager that a potentially recursive layout is starting.
 void setClosed(boolean closed)
          Sets the path open or closed.
 void setExact(boolean exact)
          Sets whether the algorithm should iterate to get exact spacing or should only run once.
 void setFlatness(double flatness)
          Sets the flatness of the FlatteninPathIterator used to convert the Shape to points.
 void setInvertChildren(boolean invertChildren)
          Sets whether this layout manager should invert its children before laying them out.
 void setShape(java.awt.Shape shape)
          Sets the shape that this layout manager will use.
 void setSpacing(double space)
          Set the spacing used by the layout algorithm during its first iteration.
 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.
 void setTolerance(double tolerance)
          Sets the tolerance, ie the error allowed, in laying out objects on the path.
 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
 

Constructor Detail

ZPathLayoutManager

public ZPathLayoutManager()
Default Constructor - uses default values unless specifically set


ZPathLayoutManager

public ZPathLayoutManager(java.awt.Shape s)
Constructor that accepts a shape

Parameters:
s - The shape used for layout
Method Detail

clone

public java.lang.Object clone()
Returns a clone of this layout manager.

Specified by:
clone in interface ZLayoutManager
Overrides:
clone in class java.lang.Object

preLayout

public void preLayout(ZGroup node)
Notify the layout manager that a potentially recursive layout is starting. This is called before any children are layed out.

Specified by:
preLayout in interface ZLayoutManager
Parameters:
node - The node to apply this layout algorithm to.

postLayout

public void postLayout(ZGroup node)
Notify the layout manager that the layout for this node has finished This is called after all children and the node itself are layed out.

Specified by:
postLayout in interface ZLayoutManager
Parameters:
node - The node to apply this layout algorithm to.

doLayout

public void doLayout(ZGroup node,
                     int millis)
Apply this manager's layout algorithm to the specified node's children, and animate the changes over time.

Specified by:
doLayout in interface ZLayoutManager
Parameters:
node - The node to apply this layout algorithm to.
millis - The number of milliseconds over which to animate layout changes.

doLayout

public void doLayout(ZGroup node)
Apply this manager's layout algorithm to the specified node's children.

Specified by:
doLayout in interface ZLayoutManager
Parameters:
node - The node to apply this layout algorithm to.

setInvertChildren

public void setInvertChildren(boolean invertChildren)
Sets whether this layout manager should invert its children before laying them out. That is, should it lay out the children from front to back rather than back to front


getInvertChildren

public boolean getInvertChildren()
Gets whether this layout manager inverts its children before laying them out. That is, does it lay out the children from front to back rather than back to front


getClosed

public boolean getClosed()
Determine whether the path is closed.

Returns:
Is the path closed?

setClosed

public void setClosed(boolean closed)
Sets the path open or closed.

Parameters:
closed - True to make this path closed.

getFlatness

public double getFlatness()
Return the current flatness of the FlatteningPathIterator used to convert the Shape to points.

Returns:
the current flatness.

setFlatness

public void setFlatness(double flatness)
Sets the flatness of the FlatteninPathIterator used to convert the Shape to points.

Parameters:
flatness - the flatness.

getExact

public boolean getExact()
Determine if exact spacing was specified.

Returns:
true if exact spacing was specified, false otherwise.

setExact

public void setExact(boolean exact)
Sets whether the algorithm should iterate to get exact spacing or should only run once.

Parameters:
exact - Whether exact spacing is specified.

getTolerance

public double getTolerance()
Get the tolerance allowed if exact spacing is specified.

Returns:
The tolerance.

setTolerance

public void setTolerance(double tolerance)
Sets the tolerance, ie the error allowed, in laying out objects on the path.

Parameters:
tolerance - The tolerance allowed if exact spacing is specified.

getShape

public java.awt.Shape getShape()
Get the shape currently in use by this object.

Returns:
The shape.

setShape

public void setShape(java.awt.Shape shape)
Sets the shape that this layout manager will use. Gets the points from this shape using a FlatteningPathIterator with flatness constant of 1.0 by default.


getSpace

public double getSpace()
The current spacing used by the layout algorithm during its first iteration.

Returns:
The current spacing.

setSpacing

public void setSpacing(double space)
Set the spacing used by the layout algorithm during its first iteration.

Parameters:
space - The spacing.

writeObject

public void writeObject(ZObjectOutputStream out)
                 throws java.io.IOException
Write out all of this object's state.

Specified by:
writeObject in interface ZSerializable
Parameters:
out - The stream that this object writes into
java.io.IOException

writeObjectRecurse

public void writeObjectRecurse(ZObjectOutputStream out)
                        throws java.io.IOException
Specify which objects this object references in order to write out the scenegraph properly

Specified by:
writeObjectRecurse in interface ZSerializable
Parameters:
out - The stream that this object writes into
java.io.IOException

setState

public 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. After the object is created with its default no-arg constructor, this method will be called on the object once for each bit of state that was written out through calls to ZObjectOutputStream.writeState() within the writeObject method.

Specified by:
setState in interface ZSerializable
Parameters:
fieldType - The fully qualified type of the field
fieldName - The name of the field
fieldValue - The value of the field


Copyright 2003 by University of Maryland, College Park, MD 20742, USA All rights reserved.