| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
  |
  +--edu.umd.cs.jazz.ZSceneGraphObject
        |
        +--edu.umd.cs.jazz.ZNode
              |
              +--edu.umd.cs.jazz.ZGroup
ZGroup is a node with children. Applications may use ZGroup to "group" children. By inserting a group node above several children, the group node can then be manipulated which will affect all of its children. Groups are typically used when several objects should be treated as a semantic unit.
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  ZList.ZNodeList | 
children
The array of children under this group node.  | 
static boolean | 
childrenFindable_DEFAULT
 | 
static boolean | 
childrenPickable_DEFAULT
 | 
static boolean | 
hasOneChild_DEFAULT
 | 
| Fields inherited from class edu.umd.cs.jazz.ZNode | 
findable_DEFAULT, pickable_DEFAULT, savable_DEFAULT, selectable_DEFAULT | 
| Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject | 
bounds, listenerList, volatileBounds, volatileBounds_DEFAULT | 
| Constructor Summary | |
ZGroup()
Constructs an empty ZGroup.  | 
|
ZGroup(ZNode child)
Constructs a new group node with the specified node as a child of the new group.  | 
|
| Method Summary | |
 void | 
addChild(ZNode child)
Add a node to be a new child of this group node.  | 
protected  void | 
addChildImpl(ZNode child,
             boolean fireEvent)
The implementation of the addChild method  | 
 void | 
addChildren(java.util.Collection newChildren,
            boolean fireEvent)
Adds a collection of nodes to be new children of this group node.  | 
 void | 
addGroupListener(ZGroupListener l)
Adds the specified group listener to receive group events from this node.  | 
 void | 
childAddedNotification(ZNode child,
                       boolean isModification)
Notifies all listeners that have registered interest for notification on ZGroupEvents that a child has been added to the group, then percolates the event up scenegraph, notifying any listeners on any higher ZGroup nodes.  | 
 void | 
childRemovedNotification(ZNode child,
                         boolean isModification)
Notifies all listeners that have registered interest for notification on ZGroupEvents that a child has been removed from the group, then percolates the event up scenegraph, notifying any listeners on any higher ZGroup nodes.  | 
protected  void | 
computeBounds()
Recomputes and caches the bounds for this node.  | 
 java.lang.String | 
dump()
Generate a string that represents this object for debugging.  | 
protected  java.lang.Object | 
duplicateObject()
Returns a clone of this object.  | 
 void | 
extract()
Extract this node from the tree, merging the nodes above and below it.  | 
protected  int | 
findNodes(ZFindFilter filter,
          java.util.ArrayList nodes)
Internal method to return the list of nodes that are accepted by the specified filter in the subtree rooted with this.  | 
 ZNode | 
getChild(int i)
Returns the i'th child of this node.  | 
 ZNode[] | 
getChildren()
Return a copy of the array of children of this node.  | 
 boolean | 
getChildrenFindable()
Determines if this node finds its children.  | 
 java.util.Iterator | 
getChildrenIterator()
Return an iterator over the children of this group in the proper order.  | 
 boolean | 
getChildrenPickable()
Determines if this node picks its children.  | 
 ZNode[] | 
getChildrenReference()
Returns a reference to the actual children of this node.  | 
 int | 
getNumChildren()
Return the number of children of this group node.  | 
 ZBounds | 
getShallowBounds()
Return the bounds of this ZGroup without taking the groups children into consideration.  | 
 boolean | 
getVolatileBounds()
Determines if this node is volatile.  | 
 boolean | 
hasOneChild()
Determines if this group node can have no more than one child  | 
 int | 
indexOf(ZNode child)
Searches for the first occurrence of the given child in the children of this node.  | 
 void | 
insertAbove(ZNode child)
Insert this group node above the specified node.  | 
 java.util.Iterator | 
iterator()
Deprecated. use getChildrenIterator() instead.  | 
 void | 
lower(ZNode child)
Lowers the specified child node within the drawing order of this node's children, so it gets rendered below (before) all of its siblings.  | 
 void | 
lowerTo(ZNode child,
        ZNode beforeNode)
Lowers the specified child node within the drawing order of this node's siblings, so it gets rendered below (before) the specified node.  | 
 boolean | 
pick(java.awt.geom.Rectangle2D rect,
     ZSceneGraphPath path)
Returns the first object under the specified rectangle (if there is one) in the subtree rooted with this as searched in reverse (front-to-back) order.  | 
 void | 
raise(ZNode child)
Raises the specified child node within the drawing order of this node's children, so it gets rendered above (after) all of its siblings.  | 
 void | 
raiseTo(ZNode child,
        ZNode afterNode)
Raises the specified child node within the drawing order of this node's siblings, so it gets rendered above (after) the specified node.  | 
 void | 
removeAllChildren()
Remove all chidren from this group node.  | 
 void | 
removeChild(int index)
Remove the child at the specified position of this group node's children.  | 
 void | 
removeChild(ZNode child)
Remove the specified child node from this group node.  | 
protected  void | 
removeChild(ZNode child,
            boolean fireEvent)
Remove the specified child node from this group node.  | 
protected  void | 
removeChildImpl(int index,
                boolean fireEvent)
The implementation of the removeChild method @param index The position of the child to be removed @param fireEvent Should the group event be fired  | 
 void | 
removeGroupListener(ZGroupListener l)
Removes the specified group listener so that it no longer receives group events from this group.  | 
 void | 
removeNodeListener(ZNodeListener l)
This method overriddes ZNode.removeNodeListener so as to properly update the hasNodeListener bit taking into consideration the ZGroup's children.  | 
 void | 
render(ZRenderContext renderContext)
Renders this node which results in its children getting painted.  | 
 void | 
setChildrenFindable(boolean childrenFindable)
Specifies whether this node should find its children.  | 
 void | 
setChildrenPickable(boolean childrenPickable)
Specifies whether this node should pick its children.  | 
 void | 
setHasOneChild(boolean oneChild)
Specifies if this group is only allowed to have a maxium of one child.  | 
 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 | 
trimToSize()
Trims the capacity of the array that stores the children list points to the actual number of points.  | 
 void | 
updateHasNodeListener()
Updates the hasNodeListener bit taking into consideration the ZGroup's children.  | 
protected  void | 
updateVolatility()
Internal method to compute and cache the volatility of a node, to recursively call the parents to compute volatility.  | 
 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.ZNode | 
addClientProperty, addNodeListener, editor, getClientProperty, getGlobalBounds, getGlobalToLocalTransform, getLocalToGlobalTransform, getParent, getRoot, globalToLocal, globalToLocal, hasNodeListener, isAncestorOf, isDescendentOf, isFindable, isPickable, isSavable, isSelectable, localToGlobal, localToGlobal, lower, lowerTo, percolateEventUpSceneGraph, putClientProperty, raise, raiseTo, remove, repaint, repaint, repaint, reparent, replaceWith, setEditorFactory, setFindable, setParent, setPickable, setSavable, setSelectable, updateBounds, updateObjectReferences, writeReplace | 
| Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject | 
addMouseListener, addMouseMotionListener, clone, fireEvent, fireMouseEvent, getBounds, getBoundsReference, getListenerList, hasLisenerOfType, hasMouseListener, processMouseEvent, removeEventListener, removeMouseListener, removeMouseMotionListener, reshape, setBounds, setVolatileBounds | 
| Methods inherited from class java.lang.Object | 
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
public static final boolean childrenPickable_DEFAULT
public static final boolean childrenFindable_DEFAULT
public static final boolean hasOneChild_DEFAULT
protected ZList.ZNodeList children
| Constructor Detail | 
public ZGroup()
public ZGroup(ZNode child)
child - Child of the new group node.| Method Detail | 
protected java.lang.Object duplicateObject()
duplicateObject in class ZNodeZSceneGraphObject.duplicateObject()public void trimToSize()
trimToSize in class ZNodepublic void insertAbove(ZNode child)
 This method may fire NODE_ADDED or NODE_REMOVED ZGroupEvents.
 ZGroupEvents now contains a method isModificationEvent() to
 distinguish a modification event from a 
child - the child node that this node should go above.ZGroupEventpublic void extract()
 This method may fire NODE_ADDED or NODE_REMOVED ZGroupEvents.
 ZGroupEvents now contains a method isModificationEvent() to
 distinguish a modification event from a 
extract in class ZNodeZGroupEventpublic void addChild(ZNode child)
 This method may fire NODE_ADDED or NODE_REMOVED ZGroupEvents.
 ZGroupEvents now contains a method isModificationEvent() to
 distinguish a modification event from a 
If this group has 'hasOneChild' set, and if adding this child would result in there being more than one child, then a ZTooManyChildrenException is thrown.
child - The new child node.ZGroupEvent
protected void addChildImpl(ZNode child,
                            boolean fireEvent)
child - The child to be addedfireEvent - Should the group event be fired
public void addChildren(java.util.Collection newChildren,
                        boolean fireEvent)
newChildren - The children to be addedfireEvent - Should the group event be fired for each child added.public void removeAllChildren()
 This method may fire NODE_ADDED or NODE_REMOVED ZGroupEvents.
 ZGroupEvents now contains a method isModificationEvent() to
 distinguish a modification event from a 
child - The child to be removed.ZGroupEventpublic void removeChild(int index)
 This method may fire NODE_ADDED or NODE_REMOVED ZGroupEvents.
 ZGroupEvents now contains a method isModificationEvent() to
 distinguish a modification event from a 
index - The position of the child node to be removed.ZGroupEvent
protected void removeChild(ZNode child,
                           boolean fireEvent)
 This method may fire NODE_ADDED or NODE_REMOVED ZGroupEvents.
 ZGroupEvents now contains a method isModificationEvent() to
 distinguish a modification event from a 
child - The child to be removed.fireEvent - Should the group event be fired.ZGroupEventpublic void removeChild(ZNode child)
 This method may fire NODE_ADDED or NODE_REMOVED ZGroupEvents.
 ZGroupEvents now contains a method isModificationEvent() to
 distinguish a modification event from a 
child - The child to be removed.ZGroupEvent
protected void removeChildImpl(int index,
                               boolean fireEvent)
public int indexOf(ZNode child)
child - The child to search forpublic ZNode[] getChildren()
public java.util.Iterator getChildrenIterator()
public java.util.Iterator iterator()
public ZNode getChild(int i)
public ZNode[] getChildrenReference()
getNumChildren().
 Warning: This method returns a reference to an internal array. Any modification of this array will result in undefined behavior.
public int getNumChildren()
public void raise(ZNode child)
child - the child node to be raised.
public void raiseTo(ZNode child,
                    ZNode afterNode)
 If the specified reference node is null, then this node is raised to be the
 last node rendered of its siblings (i.e., equivalent to calling raise(edu.umd.cs.jazz.ZNode)
child - the child node to be raised.afterNode - The node to raise this node after.public void lower(ZNode child)
child - the child to be lowered.
public void lowerTo(ZNode child,
                    ZNode beforeNode)
 If the specified reference node is null, then this node is lowered to be the
 first node rendered of its siblings (i.e., equivalent to calling lower(edu.umd.cs.jazz.ZNode)
child - the child to be lowered.beforeNode - The node to lower this node before.protected void updateVolatility()
updateVolatility in class ZNodeZSceneGraphObject.setVolatileBounds(boolean), 
getVolatileBounds()public boolean getVolatileBounds()
ZSceneGraphObject.setVolatileBounds(boolean), or if any
 of its children are volatile.
 All parents of this node are also volatile when this is volatile.
 Volatile objects are those objects that change regularly, such as an object that is animated, or one whose rendering depends on its context.
getVolatileBounds in class ZSceneGraphObjectZSceneGraphObject.setVolatileBounds(boolean)public void setChildrenPickable(boolean childrenPickable)
childrenPickable - True if this node should pick its childrenZDrawingSurface.pick(int, int)public final boolean getChildrenPickable()
public void setChildrenFindable(boolean childrenFindable)
childrenFindable - True if this node should find its childrenZDrawingSurface.findNodes(edu.umd.cs.jazz.util.ZFindFilter)public final boolean getChildrenFindable()
public void setHasOneChild(boolean oneChild)
Jazz provides ZSceneGraphEditor to manage these decorator chains, and that class should be examined for more information.
oneChild - True if this node can have no more than one childZSceneGraphEditorpublic final boolean hasOneChild()
ZSceneGraphEditorpublic void render(ZRenderContext renderContext)
The transform, clip, and composite will be set appropriately when this object is rendered. It is up to this object to restore the transform, clip, and composite of the Graphics2D if this node changes any of them. However, the color, font, and stroke are unspecified by Jazz. This object should set those things if they are used, but they do not need to be restored.
render in class ZNoderenderContext - The graphics context to use for rendering.protected void computeBounds()
computeBounds in class ZSceneGraphObjectpublic ZBounds getShallowBounds()
public void removeNodeListener(ZNodeListener l)
removeNodeListener in class ZNodel - The node listener to be removedpublic void updateHasNodeListener()
public void addGroupListener(ZGroupListener l)
l - the group listener.public void removeGroupListener(ZGroupListener l)
l - the group listener.
public void childAddedNotification(ZNode child,
                                   boolean isModification)
child - The child being added or removed from this nodeisModification - true if this is a modification event.EventListenerList, 
ZGroupEvent
public void childRemovedNotification(ZNode child,
                                     boolean isModification)
child - The child being added or removed from this nodeisModification - true if this is a modification event.EventListenerList, 
ZGroupEvent
public boolean pick(java.awt.geom.Rectangle2D rect,
                    ZSceneGraphPath path)
If childrenPickable is false, then this will never return a child as the picked node. Instead, this node will be returned if any children are picked. If no children are picked, then this will return null.
pick in class ZNoderect - Coordinates of pick rectangle in local coordinatespath - The path through the scenegraph to the picked node. Modified by this call.ZDrawingSurface.pick(int, int)
protected int findNodes(ZFindFilter filter,
                        java.util.ArrayList nodes)
If findChildren is false, then the children of this node are are not checked for being found, and only this node (possibly) is found.
findNodes in class ZNodefilter - The filter that decides whether or not to include individual nodes in the find listnodes - the accumulation list (results will be place here).ZNode.isFindable(), 
ZFindFilterpublic java.lang.String dump()
dump in class ZNodeZDebug.dump(edu.umd.cs.jazz.ZNode)
public void writeObject(ZObjectOutputStream out)
                 throws java.io.IOException
writeObject in interface ZSerializablewriteObject in class ZNodeout - The stream that this object writes into
public void writeObjectRecurse(ZObjectOutputStream out)
                        throws java.io.IOException
writeObjectRecurse in interface ZSerializablewriteObjectRecurse in class ZNodeout - The stream that this object writes into
public void setState(java.lang.String fieldType,
                     java.lang.String fieldName,
                     java.lang.Object fieldValue)
setState in interface ZSerializablesetState in class ZNodefieldType - 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 | |||||||||