Jazz API Documentation

edu.umd.cs.jazz
Class ZFadeGroup

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

public class ZFadeGroup
extends ZGroup
implements ZSerializable, java.io.Serializable

ZFadeGroup is a group node that has control over transparency of itself (and sub-tree), and its minimum and maximum magnification.

See Also:
Serialized Form

Field Summary
static float alpha_DEFAULT
           
static float maxMag_DEFAULT
           
static float minMag_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, objRefTable, volatileBounds_DEFAULT
 
Constructor Summary
ZFadeGroup()
          Constructs a new empty fade group node.
ZFadeGroup(ZNode child)
          Constructs a new fade group node with the specified node as a child of the new group.
 
Method Summary
 java.lang.Object clone()
          Duplicates the current node by using the copy constructor.
 void duplicateObject(ZFadeGroup refNode)
          Copies all object information from the reference object into the current object.
 float getAlpha()
          Set the alpha value (opacity) for this node.
protected  java.awt.Composite getComposite(java.awt.Composite currentComposite, float currentMag)
          Internal method to compute and access an alpha Composite given the current rendering composite, and the current magnification.
 float getMaxMag()
          Get the maximum magnification for this node.
 float getMinMag()
          Get the minimumn magnification for this node.
 boolean isVisible(float mag)
          Determines if this fade node is visible at the specified magnification.
 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 render(ZRenderContext renderContext)
          Renders this node which results in the node's visual component getting rendered, followed by its children getting rendered.
 void setAlpha(float alpha)
          Set the alpha value (opacity) for this node.
 void setMaxMag(float maxMag)
          Set the maximumn magnification for this node.
 void setMinMag(float minMag)
          Set the minimumn magnification for this node.
 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, addGroupListener, computeBounds, dump, duplicateObject, fireGroupEvent, getChild, getChildren, getChildrenFindable, getChildrenIterator, getChildrenPickable, getNumChildren, hasOneChild, indexOf, insertAbove, lower, lowerTo, raise, raiseTo, remove, removeChild, removeGroupListener, setChildrenFindable, setChildrenPickable, setHasOneChild, trimToSize, updateVolatility
 
Methods inherited from class edu.umd.cs.jazz.ZNode
addClientProperty, addMouseListener, addMouseMotionListener, duplicateObject, editor, fireMouseEvent, getClientProperty, getGlobalBounds, getGlobalToLocalTransform, getLocalToGlobalTransform, getParent, getRoot, globalToLocal, globalToLocal, hasMouseListener, isAncestorOf, isDescendentOf, isFindable, isPickable, isSavable, localToGlobal, localToGlobal, lower, lowerTo, putClientProperty, raise, raiseTo, removeMouseListener, removeMouseMotionListener, repaint, repaint, reparent, replaceWith, setEditorFactory, setFindable, setParent, setPickable, setSavable, updateBounds, updateObjectReferences, writeReplace
 
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject
duplicateObject, getBounds, getVolatileBounds, reshape, setVolatileBounds
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alpha_DEFAULT

public static final float alpha_DEFAULT

minMag_DEFAULT

public static final float minMag_DEFAULT

maxMag_DEFAULT

public static final float maxMag_DEFAULT
Constructor Detail

ZFadeGroup

public ZFadeGroup()
Constructs a new empty fade group node.

ZFadeGroup

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

duplicateObject

public void duplicateObject(ZFadeGroup refNode)
Copies all object information from the reference object into the current object. This method is called from the clone method. All ZSceneGraphObjects objects contained by the object being duplicated are duplicated, except parents which are set to null. This results in the sub-tree rooted at this object being duplicated.
Parameters:
refNode - The reference node to copy

clone

public java.lang.Object clone()
Duplicates the current node by using the copy constructor. The portion of the reference node that is duplicated is that necessary to reuse the node in a new place within the scenegraph, but the new node is not inserted into any scenegraph. The node must be attached to a live scenegraph (a scenegraph that is currently visible) or be registered with a camera directly in order for it to be visible.

In particular, the visual component associated with this group gets duplicated along with the subtree.

Overrides:
clone in class ZGroup
Returns:
A copy of this node.
See Also:
ZNode.updateObjectReferences(edu.umd.cs.jazz.util.ZObjectReferenceTable)

getAlpha

public float getAlpha()
Set the alpha value (opacity) for this node. Alpha values are applied multiplicitively with the current alpha values at render time.
Returns:
The alpha value for this node.

setAlpha

public void setAlpha(float alpha)
Set the alpha value (opacity) for this node. Alpha values are applied multiplicitively with the current alpha values at render time. Alpha valus range from 0 to 1 where 0 represents a node being completely transparent, and 1 represents a node being completely opaque. Alpha is clamped to the range [0, 1].
Parameters:
alpha - The new alpha value for this node.

getMinMag

public float getMinMag()
Get the minimumn magnification for this node.
Returns:
The minimum magnification of this node

setMinMag

public void setMinMag(float minMag)
Set the minimumn magnification for this node. This node will not be rendered when the current rendering camera's magnification is less than then specified minimum magnification for this node. The node with smoothly fade from its regular opacity to completely transparent during a small magnification range just before the minimum magnification is reached. This transparency control affects the entire sub-tree rooted at this node. The minimum magnification has a minimum value of 0, and is clamped to that value.
Parameters:
minMag - The new minimumn magnification for this node.

getMaxMag

public float getMaxMag()
Get the maximum magnification for this node.
Returns:
The maximum magnification of this node

setMaxMag

public void setMaxMag(float maxMag)
Set the maximumn magnification for this node. This node will not be rendered when the current rendering camera's magnification is greater than then specified maximum magnification for this node. The node with smoothly fade from its regular opacity to completely transparent during a small magnification range just before the maximum magnification is reached. This transparency control affects the entire sub-tree rooted at this node. To disable the maximum magnification feature, set the value to any negative value.
Parameters:
maxMag - The new maximumn magnification for this node.

isVisible

public boolean isVisible(float mag)
Determines if this fade node is visible at the specified magnification.
Parameters:
mag - The magnification to check at
Returns:
True if this node is visible at the specified magnification.

getComposite

protected java.awt.Composite getComposite(java.awt.Composite currentComposite,
                                          float currentMag)
Internal method to compute and access an alpha Composite given the current rendering composite, and the current magnification. It determines the alpha based on this node's alpha value, minimum magnification, and maximum magnification.
Parameters:
currentComposite - The composite in the current render context
currentMag - The magnification of the current rendering camera
Returns:
Composite The Composite to use to render this node

render

public void render(ZRenderContext renderContext)
Renders this node which results in the node's visual component getting rendered, followed by its children getting rendered.

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.

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

pick

public 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. This performs a depth-first search, first picking children. Only returns a node if this is "pickable". If no nodes in the sub-tree are picked, then this node's visual component is picked.

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, or if this node's visual component is picked. Else, it will return null.

Overrides:
pick in class ZGroup
Parameters:
rect - Coordinates of pick rectangle in local coordinates
mag - The magnification of the camera being picked within.
Returns:
The picked node, or null if none
See Also:

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

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

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

Jazz API Documentation