edu.umd.cs.jazz
Class ZClipGroup

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

public class ZClipGroup
extends ZGroup

ZClipGroup applies a clip to the current ZRenderContext before rendering its children. This clip is specified by a ZShape. The clip can optionaly be set to visible. This means that the ZShape used to specify the clip will be drawn before the ZClipGroup's children are drawn. This has the effect of giving the clip a background. The clip can also be optionaly set to pickable.

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:
Serialized Form

Field Summary
protected  ZShape clip
           
protected  boolean isClipPickable
           
protected  boolean isClipVisible
           
 
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
ZClipGroup()
          ZClipGroup constructor comment.
ZClipGroup(ZNode child)
          ZClipGroup constructor comment.
 
Method Summary
protected  void computeBounds()
          Recomputes and caches the bounds for this node.
protected  java.lang.Object duplicateObject()
          Returns a clone of this object.
 ZShape getClip()
          ZClipGroup constructor comment.
 boolean isClipPickable()
          Used to query if the clip is pickable or not.
 boolean isClipVisible()
          Used to query if the clip is visible or not.
 boolean pick(java.awt.geom.Rectangle2D rect, ZSceneGraphPath path)
          Pick is overiden so that we can take the clip into consideration when picking.
 void render(ZRenderContext renderContext)
          ZClipGroup constructor comment.
 void setClip(ZShape aClip)
          Set the current clip to a ZShape.
 void setClipPickable(boolean aBoolean)
          If the clip is set to pickable, then if we fail to pick any children we next see if we can pick the ZShape that defines the clip.
 void setClipVisible(boolean aBoolean)
          If a the clip is set to visible then then ZShape used to define the clip will be drawn after the clip has been applied to the ZRenderContext, but before the children have been drawn.
 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 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.ZGroup
addChild, addChildImpl, addChildren, addChildren, addGroupListener, childAddedNotification, childRemovedNotification, computeVolatileBounds, dump, 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, 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, updateObjectReferences
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clip

protected ZShape clip

isClipVisible

protected boolean isClipVisible

isClipPickable

protected boolean isClipPickable
Constructor Detail

ZClipGroup

public ZClipGroup()
ZClipGroup constructor comment.


ZClipGroup

public ZClipGroup(ZNode child)
ZClipGroup constructor comment.

Parameters:
child - edu.umd.cs.jazz.ZNode
Method Detail

isClipVisible

public boolean isClipVisible()
Used to query if the clip is visible or not.


setClipVisible

public void setClipVisible(boolean aBoolean)
If a the clip is set to visible then then ZShape used to define the clip will be drawn after the clip has been applied to the ZRenderContext, but before the children have been drawn. This has the affect of drawing a background in the clip.


isClipPickable

public boolean isClipPickable()
Used to query if the clip is pickable or not.


setClipPickable

public void setClipPickable(boolean aBoolean)
If the clip is set to pickable, then if we fail to pick any children we next see if we can pick the ZShape that defines the clip. If the ZShape returns true then we set the ZClipGroup as the picked object, and return true.


computeBounds

protected void computeBounds()
Description copied from class: ZGroup
Recomputes and caches the bounds for this node. Generally this method is called by reshape when the bounds have changed, and it should rarely directly elsewhere. A ZGroup bounds is the union of its children's bounds

Overrides:
computeBounds in class ZGroup

getClip

public ZShape getClip()
ZClipGroup constructor comment.


duplicateObject

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

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

pick

public boolean pick(java.awt.geom.Rectangle2D rect,
                    ZSceneGraphPath path)
Pick is overiden so that we can take the clip into consideration when picking.

Overrides:
pick in class ZGroup
Parameters:
rect - Coordinates of pick rectangle in local coordinates
path - 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)

render

public void render(ZRenderContext renderContext)
ZClipGroup constructor comment.

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

setClip

public void setClip(ZShape aClip)
Set the current clip to a ZShape.


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 ZGroup
Parameters:
fieldType - The fully qualified type of the field
fieldName - The name of the field
fieldValue - The value of the field

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 ZGroup
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 ZGroup
Parameters:
out - The stream that this object writes into
java.io.IOException


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