Jazz API Documentation

edu.umd.cs.jazz
Class ZSelectionGroup

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.ZSelectionGroup
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, ZSerializable

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

ZSelectionGroup is a visual group node that provides functionality for specifying selection. Inserting a selection group in the scenegraph will visually select its subtree. It has utility methods for selecting and unselecting nodes, and for determining the selected nodes in a sub-tree. It manages a visual component that actually represents the selection, and shows a selected node by surrounding its children with a 1 pixel wide line. This class could be extended to replace the visual component if an application wants to define a different visual look.

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.

See Also:
Serialized Form

Field Summary
static java.awt.Color penColor_DEFAULT
           
 
Fields inherited from class edu.umd.cs.jazz.ZVisualGroup
visualComponentPickable_DEFAULT
 
Fields inherited from class edu.umd.cs.jazz.ZGroup
childrenFindable_DEFAULT, childrenPickable_DEFAULT, hasOneChild_DEFAULT
 
Fields inherited from class edu.umd.cs.jazz.ZNode
findable_DEFAULT, listenerList, pickable_DEFAULT, savable_DEFAULT
 
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject
bounds, volatileBounds, volatileBounds_DEFAULT
 
Constructor Summary
ZSelectionGroup()
          Constructs a new ZSelectionGroup.
ZSelectionGroup(ZNode child)
          Constructs a new select group node with the specified node as a child of the new group.
 
Method Summary
protected  ZVisualComponent createSelectComponent()
          Internal method to create the visual component that represents the selection.
 java.awt.Color getPenColor()
          Get the pen color that is used to render the selection.
static java.util.ArrayList getSelectedNodes(ZCamera camera)
          Return a list of the selected nodes in the portion of the scenegraph visible from the specified camera.
static java.util.ArrayList getSelectedNodes(ZNode node)
          Return a list of the selected nodes in the subtree rooted at the specified node (including the root if it is selected).
static boolean isSelected(ZNode node)
          Determine if the specified node is selected.
static ZSelectionGroup select(ZNode node)
          Select the specified node.
 void setPenColor(java.awt.Color color)
          Set the pen color that is used to render the selection.
static void unselect(ZNode node)
          Unselect the specified node.
static void unselectAll(ZCamera camera)
          Unselect all currently selected nodes in the portion of the scenegraph visible from the specified camera.
static void unselectAll(ZNode node)
          Unselect all currently selected nodes in the subtree rooted at the specified node (including the root if it is selected).
 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, duplicateObject, getBackVisualComponent, getBackVisualComponentBounds, getBackVisualComponentGlobalBounds, getFrontVisualComponent, getFrontVisualComponentBounds, getFrontVisualComponentGlobalBounds, isBackVisualComponentPickable, isFrontVisualComponentPickable, pick, render, setBackVisualComponent, setBackVisualComponentPickable, setFrontVisualComponent, setFrontVisualComponentPickable, setState, updateVolatility
 
Methods inherited from class edu.umd.cs.jazz.ZGroup
addChild, addChildImpl, addGroupListener, dump, extract, findNodes, fireGroupEvent, getChild, getChildren, getChildrenFindable, getChildrenIterator, getChildrenPickable, getChildrenReference, getNumChildren, getVolatileBounds, hasOneChild, indexOf, insertAbove, iterator, lower, lowerTo, raise, raiseTo, removeAllChildren, removeChild, removeChild, removeChild, removeChildImpl, removeGroupListener, removeNodeListener, setChildrenFindable, setChildrenPickable, setHasOneChild, trimToSize, updateHasNodeListener
 
Methods inherited from class edu.umd.cs.jazz.ZNode
addClientProperty, addMouseListener, addMouseMotionListener, addNodeListener, editor, fireEvent, fireMouseEvent, fireNodeEvent, getClientProperty, getGlobalBounds, getGlobalToLocalTransform, getLocalToGlobalTransform, getParent, getRoot, globalToLocal, globalToLocal, hasMouseListener, hasNodeListener, isAncestorOf, isDescendentOf, isFindable, isPickable, isSavable, localToGlobal, localToGlobal, lower, lowerTo, putClientProperty, raise, raiseTo, remove, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, reparent, replaceWith, setEditorFactory, setFindable, setParent, setPickable, setSavable, updateBounds, updateObjectReferences, writeReplace
 
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject
clone, getBounds, getBoundsReference, reshape, setBounds, setVolatileBounds
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

penColor_DEFAULT

public static final java.awt.Color penColor_DEFAULT
Constructor Detail

ZSelectionGroup

public ZSelectionGroup()
Constructs a new ZSelectionGroup. The node must be attached to a live scenegraph (a scenegraph that is currently visible) in order for it to be visible.

ZSelectionGroup

public ZSelectionGroup(ZNode child)
Constructs a new select group node with the specified node as a child of the new group.
Parameters:
child - Child of the new group node.
Method Detail

getSelectedNodes

public static java.util.ArrayList getSelectedNodes(ZNode node)
Return a list of the selected nodes in the subtree rooted at the specified node (including the root if it is selected). Note that the nodes returned are the nodes at the bottom of the "decorator chain". See ZSceneGraphEditor for more information.
Parameters:
node - The subtree to check for selection
Returns:
The list of selected nodes.

getSelectedNodes

public static java.util.ArrayList getSelectedNodes(ZCamera camera)
Return a list of the selected nodes in the portion of the scenegraph visible from the specified camera. Note that the nodes returned are the nodes at the bottom of the "decorator chain". See ZSceneGraphEditor for more information.
Parameters:
camera - The camera to look through for selected nodes.
Returns:
The list of selected nodes.

select

public static ZSelectionGroup select(ZNode node)
Select the specified node. If the node is already selected, then do nothing. This manages the selection as a decorator as described in ZSceneGraphEditor.
Parameters:
node - the node to select
Returns:
the ZSelectionGroup that represents the selection

unselect

public static void unselect(ZNode node)
Unselect the specified node. If the node is not already selected, then do nothing. This manages the selection as a decorator as described in ZNode.
Parameters:
node - the node to unselect

unselectAll

public static void unselectAll(ZNode node)
Unselect all currently selected nodes in the subtree rooted at the specified node (including the root if it is selected). This manages the selection as a decorator as described in ZNode.
Parameters:
node - The subtree to check for selection

unselectAll

public static void unselectAll(ZCamera camera)
Unselect all currently selected nodes in the portion of the scenegraph visible from the specified camera. This manages the selection as a decorator as described in ZNode.
Parameters:
camera - The camera to look through for selected nodes.

isSelected

public static boolean isSelected(ZNode node)
Determine if the specified node is selected.
Returns:
true if the node is selected.

getPenColor

public java.awt.Color getPenColor()
Get the pen color that is used to render the selection.
Returns:
the pen color.

setPenColor

public void setPenColor(java.awt.Color color)
Set the pen color that is used to render the selection.
Parameters:
color - the pen color, or null if none.

createSelectComponent

protected ZVisualComponent createSelectComponent()
Internal method to create the visual component that represents the selection. Applications can change visual representation of a selected object by extending this class, and overriding this method.
Returns:
the visual component that represents the selection.

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

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

Jazz API Documentation