edu.umd.cs.jazz
Class ZHandleGroup

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

public class ZHandleGroup
extends ZGroup

ZHandleGroup is a group node that manages a collection of ZHandles. This collection is created by calling getHandles on the bottom most node of the edit group that the handle group is part of. Generally to create custom handles you should just override the getHandles method in your custom scene graph object. See ZRectangle for an example of how to do this.

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

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:
Jesse Grosjean
See Also:
ZHandle, Serialized Form

Field Summary
 
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
ZHandleGroup()
          Constructs an empty ZHandleGroup.
ZHandleGroup(ZNode child)
          Constructs a new handle group node with the specified node as a child of the new group.
 
Method Summary
protected  void addHandle(ZHandle aHandle)
          Add a new handle to this group.
 void clearHandles()
          Remove all handles from this handle group.
 void computeBounds()
          Recomputes and caches the bounds for this handle group, including the bounds of the handles that it is managing.
 ZHandleEventHandler getEventHandler()
          Get the event handler used internally by handle groups to dispatch events to their handles.
 java.util.Collection getHandles()
          Return the collection of handles that this handle group is managing.
 boolean pick(java.awt.geom.Rectangle2D rect, ZSceneGraphPath aPath)
          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 processMouseEvent(ZMouseEvent e)
          Dispatch all events received by the handler group to the handle event handler.
 void refreshHandles()
          Clears all the handles from this handle group and then adds a new set of handles created by the underlying node that this handle group is decorating.
 void relocateHandles()
          The location of handles depends on the geometry of the underlying scene graph object that they are operating on.
protected  void removeHandle(ZHandle aHandle)
          Removes a handle from this group.
 void render(ZRenderContext aRenderContext)
          Renders this handle group along with its handles.
static void setDefaultEventHandler(ZHandleEventHandler aEventHandler)
          Set the default event handler used by ZHandleGroups to dispatch events to their ZHandles.
 void setEventHandler(ZHandleEventHandler aEventHandler)
          Set the event handler used internally by handle groups to dispatch events to their handles.
 
Methods inherited from class edu.umd.cs.jazz.ZGroup
addChild, addChildImpl, addChildren, addChildren, addGroupListener, childAddedNotification, childRemovedNotification, computeVolatileBounds, dump, duplicateObject, extract, findNodes, getChild, getChildren, getChildrenFindable, getChildrenIterator, getChildrenPickable, getChildrenReference, getNumChildren, getShallowBounds, getVolatileBounds, hasOneChild, indexOf, insertAbove, iterator, lower, lowerTo, markInTransaction, markNotInTransaction, raise, raiseTo, removeAllChildren, removeAllChildren, removeChild, removeChild, removeChild, removeChildImpl, removeGroupListener, removeNodeListener, setChildrenFindable, setChildrenPickable, setHasOneChild, setState, trimToSize, updateHasNodeListener, writeObject, writeObjectRecurse
 
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, getListenerList, hasLisenerOfType, hasListenerOfType, hasMouseListener, putClientProperty, removeEventListener, removeMouseListener, removeMouseMotionListener, reshape, setBounds, startTransaction, updateObjectReferences
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZHandleGroup

public ZHandleGroup()
Constructs an empty ZHandleGroup.


ZHandleGroup

public ZHandleGroup(ZNode child)
Constructs a new handle group node with the specified node as a child of the new group. If the specified child was already a member of a tree (i.e., had a parent), then this new node is inserted in the tree above the child so that the original child is still in that tree, but with this node inserted in the middle of the tree. If the specified child does not have a parent, then it is just made a child of this node.

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

setDefaultEventHandler

public static void setDefaultEventHandler(ZHandleEventHandler aEventHandler)
Set the default event handler used by ZHandleGroups to dispatch events to their ZHandles. This can be set on an individual ZHandleGroup basis by using ZHandleGroup.setEventHandler().


setEventHandler

public void setEventHandler(ZHandleEventHandler aEventHandler)
Set the event handler used internally by handle groups to dispatch events to their handles.


getEventHandler

public ZHandleEventHandler getEventHandler()
Get the event handler used internally by handle groups to dispatch events to their handles.


addHandle

protected void addHandle(ZHandle aHandle)
Add a new handle to this group. Normally this should not be called directly. If you want custom handles to appear in a handle group override the getHandles method in the scene graph object that the handle group is decorating.


clearHandles

public void clearHandles()
Remove all handles from this handle group. To redisplay the handles use refreshHandles.


computeBounds

public void computeBounds()
Recomputes and caches the bounds for this handle group, including the bounds of the handles that it is managing. Generally this method is called by reshape when the bounds have changed, and it should rarely directly elsewhere.

Overrides:
computeBounds in class ZGroup

getHandles

public java.util.Collection getHandles()
Return the collection of handles that this handle group is managing. This should be the same collection as returned by the edit nodes getHandles method.

Overrides:
getHandles in class ZSceneGraphObject

pick

public boolean pick(java.awt.geom.Rectangle2D rect,
                    ZSceneGraphPath aPath)
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. Only returns "pickable" nodes. If the pick rect intersects one of this handle groups handles then that handle is set as the path object. The handle event handler looks at the path object to determine if a handle was picked.

Overrides:
pick in class ZGroup
Parameters:
rect - Coordinates of pick rectangle in local coordinates
aPath - The path through the scenegraph to the picked node. Modified by this call.
Returns:
The picked node, or null if none
See Also:
ZDrawingSurface.pick(int, int)

relocateHandles

public void relocateHandles()
The location of handles depends on the geometry of the underlying scene graph object that they are operating on. This method is used to tell all the handles managed by this handle group that something may have changed about that geometry and that they should update their locations.


refreshHandles

public void refreshHandles()
Clears all the handles from this handle group and then adds a new set of handles created by the underlying node that this handle group is decorating.


removeHandle

protected void removeHandle(ZHandle aHandle)
Removes a handle from this group. Normally this should not be called directly. If you want to remove handles use clearHandles.


render

public void render(ZRenderContext aRenderContext)
Renders this handle group along with its handles.

Overrides:
render in class ZGroup
Parameters:
aRenderContext - The graphics context to use for rendering.

processMouseEvent

public void processMouseEvent(ZMouseEvent e)
Dispatch all events received by the handler group to the handle event handler. This event handler is responsible for interpreting these events and sending mouse dragged messages to the handle under the mouse when appropriate.

Overrides:
processMouseEvent in class ZSceneGraphObject


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