edu.umd.cs.jazz
Class ZLayoutGroup

java.lang.Object
  |
  +--edu.umd.cs.jazz.ZSceneGraphObject
        |
        +--edu.umd.cs.jazz.ZNode
              |
              +--edu.umd.cs.jazz.ZGroup
                    |
                    +--edu.umd.cs.jazz.ZVisualGroup
                          |
                          +--edu.umd.cs.jazz.ZLayoutGroup
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, ZSerializable

public class ZLayoutGroup
extends ZVisualGroup
implements ZSerializable, java.io.Serializable

ZLayoutGroup is a visual group that wraps a layout manager that can position the node's children. The layout manager may also include a visual component that aids the layout. For instance, the tree layout manager adds links connecting the tree nodes.

ZSceneGraphEditor provides a convenience mechanism to locate, create and manage nodes of this type.

BUG 6/28/2001: JAG - ZLayoutGroup will not invalidate the layout when one of the layoutChilds bounds changes. This means that you must manually invalidate ZlayoutGroups in those cases.

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:
Ben Bederson
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.umd.cs.jazz.ZVisualGroup
visualComponentPickable_DEFAULT
 
Fields inherited from class edu.umd.cs.jazz.ZGroup
children, childrenFindable_DEFAULT, childrenPickable_DEFAULT, childrenVolatileBoundsCache, hasOneChild_DEFAULT
 
Fields inherited from class edu.umd.cs.jazz.ZNode
editorFactory, findable_DEFAULT, parent, pickable_DEFAULT, savable_DEFAULT, selectable_DEFAULT
 
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject
bounds, inTransaction, invalidBounds, invalidVolatileBounds, listenerList, volatileBounds, volatileBounds_DEFAULT
 
Constructor Summary
ZLayoutGroup()
          Constructs a new empty layout group node.
ZLayoutGroup(ZNode child)
          Constructs a new layout group node with the specified node as a child of the new group.
ZLayoutGroup(ZNode child, ZGroup layoutChild)
          Constructs a new layout group node with the specified node as a child of the new group.
 
Method Summary
 void doLayout()
          Causes the children of the specified layout node to be laid out.
protected  void doLayoutInternal(ZNode node)
          Internal method to recursively search children to look for layout nodes, and apply the layout if found.
protected  java.lang.Object duplicateObject()
          Returns a clone of this object.
 ZGroup getLayoutChild()
          Returns the current layout child for this node.
 ZLayoutManager getLayoutManager()
          Returns the current layout manager for this node.
 void invalidate()
          Specify that this layout group is out of date, and needs to be revalidated.
 void setLayoutChild(ZGroup child)
          Specifies the layout child for this node.
 void setLayoutManager(ZLayoutManager manager)
          Specifies the layout manager for this node.
 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 updateObjectReferences(ZObjectReferenceTable objRefTable)
          Called to update internal object references after a clone operation by ZSceneGraphObject.clone().
 void validate()
          Force an immediate validation of this layout node (if it was invalidated).
 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 edu.umd.cs.jazz.ZVisualGroup
computeBounds, computeVolatileBounds, getBackVisualComponent, getBackVisualComponentBounds, getBackVisualComponentGlobalBounds, getFrontVisualComponent, getFrontVisualComponentBounds, getFrontVisualComponentGlobalBounds, getShallowBounds, isBackVisualComponentPickable, isFrontVisualComponentPickable, markInTransaction, markNotInTransaction, pick, render, setBackVisualComponent, setBackVisualComponentPickable, setFrontVisualComponent, setFrontVisualComponentPickable
 
Methods inherited from class edu.umd.cs.jazz.ZGroup
addChild, addChildImpl, addChildren, addChildren, addGroupListener, childAddedNotification, childRemovedNotification, dump, extract, findNodes, getChild, getChildren, getChildrenFindable, getChildrenIterator, getChildrenPickable, getChildrenReference, getNumChildren, getVolatileBounds, hasOneChild, indexOf, insertAbove, iterator, lower, lowerTo, raise, raiseTo, removeAllChildren, removeAllChildren, removeChild, removeChild, removeChild, removeChildImpl, removeGroupListener, removeNodeListener, setChildrenFindable, setChildrenPickable, setHasOneChild, trimToSize, updateHasNodeListener
 
Methods inherited from class edu.umd.cs.jazz.ZNode
addNodeListener, editor, getGlobalBounds, getGlobalToLocalTransform, getLocalToGlobalTransform, getParent, getRoot, globalToLocal, globalToLocal, globalToLocal, hasNodeListener, isAncestorOf, isDescendentOf, isFindable, isPickable, isSavable, isSelectable, localToGlobal, localToGlobal, localToGlobal, lower, lowerTo, percolateEventUpSceneGraph, raise, raiseTo, remove, repaint, repaint, reparent, replaceWith, setEditorFactory, setFindable, setParent, setPickable, setSavable, setSelectable, setVolatileBounds, updateBounds, updateVolatility, writeReplace
 
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject
addClientProperty, addMouseListener, addMouseMotionListener, clone, endTransaction, fireEvent, fireMouseEvent, getBounds, getBoundsReference, getClientProperty, getHandles, getListenerList, hasLisenerOfType, hasListenerOfType, hasMouseListener, processMouseEvent, putClientProperty, removeEventListener, removeMouseListener, removeMouseMotionListener, reshape, setBounds, startTransaction
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZLayoutGroup

public ZLayoutGroup()
Constructs a new empty layout group node.


ZLayoutGroup

public ZLayoutGroup(ZNode child)
Constructs a new layout group node with the specified node as a child of the new group. This group will apply its layout manager (if there is one) to the children of its layoutChild node (or itself if there isn't one).

Parameters:
child - Child of the new group node.
See Also:
setLayoutChild(edu.umd.cs.jazz.ZGroup)

ZLayoutGroup

public ZLayoutGroup(ZNode child,
                    ZGroup layoutChild)
Constructs a new layout group node with the specified node as a child of the new group. This group will apply its layout manager (if there is one) to the children of its layoutChild node (or itself if there isn't one).

Parameters:
child - Child of the new group node.
Method Detail

duplicateObject

protected java.lang.Object duplicateObject()
Returns a clone of this object.

Overrides:
duplicateObject in class ZVisualGroup
See Also:
ZSceneGraphObject.duplicateObject()

updateObjectReferences

protected void updateObjectReferences(ZObjectReferenceTable objRefTable)
Called to update internal object references after a clone operation by ZSceneGraphObject.clone().

Overrides:
updateObjectReferences in class ZSceneGraphObject
Parameters:
objRefTable - Table mapping from uncloned objects to their cloned versions.
See Also:
ZSceneGraphObject.updateObjectReferences(edu.umd.cs.jazz.util.ZObjectReferenceTable)

setLayoutManager

public void setLayoutManager(ZLayoutManager manager)
Specifies the layout manager for this node.

Parameters:
manager - The new layout manager.

getLayoutManager

public final ZLayoutManager getLayoutManager()
Returns the current layout manager for this node.

Returns:
The current layout manager.

setLayoutChild

public void setLayoutChild(ZGroup child)
Specifies the layout child for this node. This node's layout manager will apply to the children of the specified child. If no layout child is specified, then the layout will apply to this node's children.

Parameters:
child - The new layout child.

getLayoutChild

public final ZGroup getLayoutChild()
Returns the current layout child for this node.

Returns:
The current layout child.

invalidate

public void invalidate()
Specify that this layout group is out of date, and needs to be revalidated. A request will be made to apply the group's layout.


validate

public void validate()
Force an immediate validation of this layout node (if it was invalidated). This will result in this node's layout being applied immediately if it was out of date, and any queued requests to layout this node will be removed.


doLayout

public void doLayout()
Causes the children of the specified layout node to be laid out. It performs a depth-first layout, doing children first, and parents last, recursively checking to see if the children have layout groups, and if so, laying them out. If there is no layout manager for this node, then nothing happens.

See Also:
getLayoutManager(), setLayoutChild(edu.umd.cs.jazz.ZGroup)

doLayoutInternal

protected void doLayoutInternal(ZNode node)
Internal method to recursively search children to look for layout nodes, and apply the layout if found.

Parameters:
node - The node to check for layout

writeObject

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

Specified by:
writeObject in interface ZSerializable
Overrides:
writeObject in class ZVisualGroup
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
Overrides:
writeObjectRecurse in class ZVisualGroup
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
Overrides:
setState in class ZVisualGroup
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.