edu.umd.cs.jazz.scenegraph
Class ZSelectionDecorator

java.lang.Object
  |
  +--edu.umd.cs.jazz.scenegraph.ZVisualComponent
        |
        +--edu.umd.cs.jazz.scenegraph.ZVisualComponentDecorator
              |
              +--edu.umd.cs.jazz.scenegraph.ZSelectionDecorator

public class ZSelectionDecorator
extends ZVisualComponentDecorator

ZSelectionDecorator is a ZVisualComponent decorator that indicates that this component chain is selected. It shows it is selected by surrounding its children with a 1 pixel wide line. Note: ZSelectionDecorator should be top in the Visual Component chain OR any VC's above it should override the default select method in ZVisualComponent.

See Also:
ZVisualComponentDecorator

Field Summary
protected  ZCamera camera
          The camera the component is selected within
protected  java.awt.Color penColor
          Pen color of the selection rectangle
 
Fields inherited from class edu.umd.cs.jazz.scenegraph.ZVisualComponentDecorator
child
 
Fields inherited from class edu.umd.cs.jazz.scenegraph.ZVisualComponent
cacheVolatile, findable, findable_DEFAULT, isVolatile, localBounds, localBoundsDirty, parent, pickable, pickable_DEFAULT, selected
 
Constructor Summary
ZSelectionDecorator()
          Constructs a new ZSelectionDecorator.
ZSelectionDecorator(ZCamera camera)
          Constructs a new ZSelectionDecorator.
 
Method Summary
protected  void computeLocalBounds()
           
protected  float computeMag()
          Internal method to compute magnification of selected component.
 ZCamera getCamera()
          Get the camera that is used to calculate the thickness of the selection visual.
 java.awt.Color getPenColor()
          Get the pen color of the selection visual
 void paint(ZRenderContext renderContext)
          Paints the selected object and then paints the selection indicator on top of the child.
 void select(ZVisualComponent vc)
          Select the specified child visual component by inserting this as a selection decorator.
 void setCamera(ZCamera camera)
          Specify the camera that is used to calculate the thickness of the selection visual.
 void setPenColor(java.awt.Color color)
          Specify the pen color of the selection visual
 void unselect()
          Unselect the visual component under this selection decorator by removing this.
 ZSerializable writeReplace()
          Selection should not be saved - thus if this decorator is saved, it just skips over itself, and saves the child instead.
 
Methods inherited from class edu.umd.cs.jazz.scenegraph.ZVisualComponentDecorator
clone, getChild, insertAbove, pick, remove, setChild, setState, setVisualComponent, toString, writeObject, writeObjectRecurse
 
Methods inherited from class edu.umd.cs.jazz.scenegraph.ZVisualComponent
damage, damage, findNode, findVisualComponent, getLocalBounds, getParent, isFindable, isPickable, isSelected, isVolatile, pickBounds, select, select, setFindable, setParent, setPickable, setSelected, setVolatile, updateBounds, updateChildBounds, updateLocalBounds, updateVolatility
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

penColor

protected java.awt.Color penColor
Pen color of the selection rectangle

camera

protected ZCamera camera
The camera the component is selected within
Constructor Detail

ZSelectionDecorator

public ZSelectionDecorator()
Constructs a new ZSelectionDecorator. This constructor does not specify a camera to be used in calculating the thickness of the selection visual. Set the camera separately to make the selection visual have a constant thickness independent of the camera magnification.
See Also:
setCamera(edu.umd.cs.jazz.scenegraph.ZCamera)

ZSelectionDecorator

public ZSelectionDecorator(ZCamera camera)
Constructs a new ZSelectionDecorator.
Parameters:
camera - The primary camera the object is being selected within. Used to compute selection rectangle thickness
Method Detail

select

public void select(ZVisualComponent vc)
Select the specified child visual component by inserting this as a selection decorator.

unselect

public void unselect()
Unselect the visual component under this selection decorator by removing this.
Overrides:
unselect in class ZVisualComponent

getPenColor

public java.awt.Color getPenColor()
Get the pen color of the selection visual
Returns:
the pen color

setPenColor

public void setPenColor(java.awt.Color color)
Specify the pen color of the selection visual
Parameters:
color - The new pen color

getCamera

public ZCamera getCamera()
Get the camera that is used to calculate the thickness of the selection visual.
Returns:
the camera

setCamera

public void setCamera(ZCamera camera)
Specify the camera that is used to calculate the thickness of the selection visual. The selection rectangle will have a constant thickness independent of the magnification of this camera.
Parameters:
camera - The new camera

paint

public void paint(ZRenderContext renderContext)
Paints the selected object and then paints the selection indicator on top of the child.
Parameters:
g2 - The graphics context to paint into.
Overrides:
paint in class ZVisualComponentDecorator

computeLocalBounds

protected void computeLocalBounds()
Overrides:
computeLocalBounds in class ZVisualComponentDecorator

computeMag

protected float computeMag()
Internal method to compute magnification of selected component. Magnification includes global transform of node plus magnification of camera that selection is associated with.

writeReplace

public ZSerializable writeReplace()
Selection should not be saved - thus if this decorator is saved, it just skips over itself, and saves the child instead.