|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.umd.cs.jazz.scenegraph.ZNode
ZNode is the basic hierarchial structure. It has zero or more child nodes. The ZNode may also exhibit a visual appearance if it contains a ZVisualComponent in it's visualComponent slot. In discussion/comments, node is used interchangeably with ZNode.
ZVisualComponent| Field Summary | |
protected float |
alpha
The alpha value that will be applied to the composite field (multiplicitivly) of the graphics2D during paint. |
static float |
alpha_DEFAULT
|
protected ZAncestorNotifier |
ancestorNotifier
|
protected boolean |
cacheVolatile
Cached volatility computation |
protected java.util.Vector |
cameras
All the cameras explicitly looking onto the scene graph rooted in this node. |
protected java.util.Vector |
children
This node's children |
protected java.util.Vector |
clientProperties
|
protected boolean |
compBoundsDirty
True if globalCompBounds is out of date and needs to be recomputed |
static boolean |
compBoundsDirty_DEFAULT
|
protected ZBounds |
globalBounds
The region (currently a rectangle) in the global space occupied by the intersection of this nodes VC and the global bounds of this nodes children |
protected boolean |
globalBoundsDirty
True if globalBounds is out of date and needs to be recomputed |
static boolean |
globalBoundsDirty_DEFAULT
|
protected ZBounds |
globalCompBounds
The region (currently a rectangle) in the global space occupied by the of this nodes VC |
protected boolean |
isVolatile
True if this node is specifically set to be volatile |
protected ZLayoutManager |
layoutManager
The layout manager that lays out the children of this node, or null if none. |
protected javax.swing.event.EventListenerList |
listenerList
|
protected float |
maxMag
This field is checked at render time. |
static float |
maxMag_DEFAULT
|
protected float |
minMag
This field is checked at render time. |
static float |
minMag_DEFAULT
|
protected ZNode |
parent
This node's parent |
protected boolean |
recursiveLayout
Specifies if this node should be recursively layed out using its parent layout manager if it doesn' have one. |
protected boolean |
save
True if this node should be saved |
static boolean |
save_DEFAULT
|
protected ZTransform |
transform
The transform applied to this node and by inheritance all of it's children as well. |
protected boolean |
visible
True if visible (when not visible, nodes are not rendered or picked) |
static boolean |
visible_DEFAULT
|
protected ZVisualComponent |
visualComponent
The visual content of this node. |
| Constructor Summary | |
ZNode()
Constructs a new ZNode. |
|
ZNode(ZNode node)
Constructs a new ZNode that is a copy of the specified node (i.e., a "copy constructor"). |
|
ZNode(ZVisualComponent vc)
Constructs a new Znode with the specified visual component. |
|
| Method Summary | |
void |
addAncestorListener(ZAncestorListener listener)
Registers listener so that it will receive ZAncestorEvents when it or any of its ancestors are changed in the following ways: A node is moved by a transform change A node is added/removed to/from the tree A node is made visible/invisible A node's alpha value is changed A node's min/max magnification is changed Events are also sent when the component or its ancestors are added or removed from the Component hierarchy |
void |
addChild(ZNode child)
Adds a child to the node. |
void |
addNodeContainerListener(ZNodeContainerListener l)
Adds the specified node container listener to receive node container events from this node. |
void |
addNodeListener(ZNodeListener l)
Adds the specified node listener to receive node events from this node. |
void |
addProperty(java.lang.String key,
java.lang.Object value)
Add a new property to this node. |
void |
addProperty(ZProperty newProp)
Add a new property to this node. |
protected void |
clearVisualComponent()
Removes a child from the node. |
java.lang.Object |
clone()
Duplicates the current node by using the copy constructor. |
protected void |
computeGlobalBounds()
Recomputes and caches the bounds for this node. |
protected void |
computeGlobalCompBounds()
Recomputes and caches the bounds for the nodes visual component. |
java.awt.geom.AffineTransform |
computeGlobalCoordinateFrame()
Return the preConcatenation of transforms that exist between this node and the rootNode This node's transform IS included. |
protected java.awt.Composite |
createComposite(java.awt.Composite currentComposite,
float currentMag)
|
void |
damage()
Damage causes the portions of the surfaces that this object appears in to be marked as needing to be repainted. |
void |
damage(boolean boundsChanged)
Damage causes the portions of the surfaces that this object appears in to be marked as needing to be repainted. |
void |
doLayout()
Causes the subtree rooted at this node to be laid out. |
java.util.Vector |
findAllCameras()
Returns a list of all the cameras that look on to this node. |
java.util.Vector |
findCameras()
Returns a list of cameras that look directly at this node or any of it's parents. |
ZNode |
findNode()
A utility function that supports finding the node that references a particular visual component. |
int |
findNodes(ZFindFilter filter,
java.util.Vector nodes)
Return the list of nodes that are accepted by the specified filter in the subtree rooted with this. |
ZRootNode |
findRoot()
Traverse the tree, find the root node, and return it. |
ZVisualComponent |
findVisualComponent(java.lang.Class type)
Traverse the list of visual components, and return the first one that is of the specified Class, or null if none. |
protected void |
fireNodeContainerEvent(int id,
ZNode child)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireNodeEvent(int id,
java.awt.geom.AffineTransform origTransform)
Notifies all listeners that have registered interest for notification on this event type. |
float |
getAlpha()
Get the alpha value (transparency) for this node. |
java.util.Vector |
getCameras()
Returns this node's list of cameras. |
java.util.Vector |
getChildren()
Return the node's children. |
ZBounds |
getCompBounds()
Return the bounds of this node's visual component transformed by this node's transform. |
ZBounds |
getGlobalBounds()
Return the bounds of the union of all descendents including the node's visual component. |
ZBounds |
getGlobalCompBounds()
Returns the bounds (in global coords) for this nodes visual component. |
ZLayoutManager |
getLayoutManager()
Returns the current layout manager for this node. |
float |
getMaxMag()
Get the maximum magnification for this node. |
float |
getMinMag()
Get the minimumn magnification for this node. |
java.util.Vector |
getObjs(java.awt.geom.Rectangle2D bounds)
Returns the children within the specified bounds |
ZNode |
getParent()
Get the node's parent. |
java.util.Vector |
getProperties()
Get all the properties that this node has. |
java.lang.Object |
getProperty(java.lang.String key)
Get the property with the specified key. |
boolean |
getRecursiveLayout()
Determine if this node is laid out recursively using its parent's layout manager if this doesn't have one. |
boolean |
getSave()
Determine if this node gets saved when written out. |
java.util.Vector |
getSelectedChildren()
Return a vector containing all of the nodes in the subgraph rooted at this node (including this node) that are currently selected. |
ZTransform |
getTransform()
Get the nodes transform. |
boolean |
getVisible()
Get the value of 'visible'. |
ZVisualComponent |
getVisualComponent()
Returns the visual component. |
protected void |
helpFindAllCameras(java.util.Vector result)
|
boolean |
isAncestor(ZNode queryNode)
Method to determine if node is ancenstor of queryNode. |
boolean |
isDescendent(ZNode queryNode)
Method to determine if node is a descendent of queryNode. |
boolean |
isVisible()
Get the value of 'visible'. |
boolean |
isVolatile()
Determines if this node is volatile. |
void |
lower()
Lowers this node within the drawing order of its siblings, so it gets rendered below (before) all of its siblings. |
void |
lowerTo(ZNode beforeNode)
Lowers this node within the drawing order of its siblings, so it gets rendered below (before) the specified node. |
void |
paint(ZRenderContext renderContext)
Paints the associated visual component and children of this node. |
ZNode |
pick(java.awt.geom.Rectangle2D rect,
float mag)
Returns the first object under the specified rectangle (if there is one) as searched in reverse (front-to-back) order. |
void |
raise()
Raises this node within the drawing order of its siblings, so it gets rendered above (after) all of its siblings. |
void |
raiseTo(ZNode afterNode)
Raises this node within the drawing order of its siblings, so it gets rendered above (after) the specified node. |
void |
removeAncestorListener(ZAncestorListener listener)
Unregisters listener so that it will no longer receive ZAncestorEvents |
void |
removeChild(ZNode child)
Removes a child from the node. |
void |
removeNodeContainerListener(ZNodeContainerListener l)
Removes the specified node container listener so that it no longer receives node container events from this node. |
void |
removeNodeListener(ZNodeListener l)
Removes the specified node listener so that it no longer receives node events from this node. |
void |
reparent(ZNode newParent)
Move this node in the hierarchy, and update its transform so that its global position does not change. |
void |
selectAll(ZCamera camera)
Select this node's visual component. |
void |
setAlpha(float alpha)
set the alpha value (transparency) for this node. |
void |
setLayoutManager(ZLayoutManager manager)
Specifies the layout manager for this node. |
void |
setMaxMag(float v)
Set the maximum magnification for this node. |
void |
setMinMag(float v)
set the minimumn magnification for this node. |
protected void |
setParent(ZNode parent)
Used internally to set a node's parent. |
void |
setRecursiveLayout(boolean recursive)
Specify if this node should be laid out recursively using its parent's layout manager if it doesn't have one. |
void |
setSave(boolean s)
Specify if this node should be saved. |
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 |
setTransform(ZTransform v)
Set the nodes transform. |
void |
setVisible(boolean v)
Set the value of 'visible'. |
void |
setVisualComponent(ZVisualComponent vc)
Set the visual component. |
void |
setVolatile(boolean v)
Specifies that this node is volatile. |
void |
swap(ZNode replacement)
Swaps this node out of the scenegraph tree, and replaces it with the specified replacement node. |
void |
transformChanged(java.awt.geom.AffineTransform origTransform)
Internal method used to notify a node that its transform has changed. |
void |
unselectAll()
Un-Select this node's visual component. |
void |
updateBounds()
Request this node to recompute its bounds. |
void |
updateChildBounds()
Implementation of inherited interface method. |
void |
updateGlobalBounds()
Notifies the node that its cached bounds are no longer valid. |
void |
updateGlobalCompBounds()
Notifies the node that the cached bounds for its visual component are no longer valid. |
void |
updateVolatility()
Internal method to compute and cache the volatility of a node, to recursively call the parents to compute volatility. |
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 |
ZSerializable |
writeReplace()
Node doesn't get written out if save property is false |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final float alpha_DEFAULT
public static final boolean compBoundsDirty_DEFAULT
public static final boolean globalBoundsDirty_DEFAULT
public static final boolean visible_DEFAULT
public static final float minMag_DEFAULT
public static final float maxMag_DEFAULT
public static final boolean save_DEFAULT
protected ZNode parent
protected java.util.Vector children
protected ZVisualComponent visualComponent
protected transient java.util.Vector cameras
protected ZTransform transform
protected transient ZBounds globalBounds
protected transient ZBounds globalCompBounds
protected float alpha
protected float minMag
protected float maxMag
protected boolean compBoundsDirty
protected boolean globalBoundsDirty
protected boolean visible
protected boolean isVolatile
protected boolean save
protected ZLayoutManager layoutManager
protected boolean recursiveLayout
protected boolean cacheVolatile
protected java.util.Vector clientProperties
protected ZAncestorNotifier ancestorNotifier
protected javax.swing.event.EventListenerList listenerList
| Constructor Detail |
public ZNode()
public ZNode(ZVisualComponent vc)
public ZNode(ZNode node)
| Method Detail |
public java.lang.Object clone()
ZNode(ZNode)public void addAncestorListener(ZAncestorListener listener)
ZAncestorEventpublic void removeAncestorListener(ZAncestorListener listener)
addAncestorListener(edu.umd.cs.jazz.event.ZAncestorListener)public void addNodeContainerListener(ZNodeContainerListener l)
l - the node container listenerpublic void removeNodeContainerListener(ZNodeContainerListener l)
l - the node container listener
protected void fireNodeContainerEvent(int id,
ZNode child)
id - The event id (NODE_ADDED, NODE_REMOVED)child - The child being added or removed from this nodeEventListenerListpublic void addNodeListener(ZNodeListener l)
l - the node listenerpublic void removeNodeListener(ZNodeListener l)
l - the node listener
protected void fireNodeEvent(int id,
java.awt.geom.AffineTransform origTransform)
id - The event id (NODE_TRANSFORMED, NODE_SHOWN, or NODE_HIDDEN)origTransform - The original transform (for transform events)EventListenerListpublic void setLayoutManager(ZLayoutManager manager)
manager - The new layout manager.public ZLayoutManager getLayoutManager()
public void setRecursiveLayout(boolean recursive)
recursive - True to layout recursively.public boolean getRecursiveLayout()
public void doLayout()
getLayoutManager()public void addChild(ZNode child)
child - is the child that gets added to this.ZSurface.restore()public void removeChild(ZNode child)
child - is the child that is removed.ZSurface.restore()public java.util.Vector getChildren()
public void reparent(ZNode newParent)
newParent - the node that this node will be put underpublic void swap(ZNode replacement)
If this was a paint start point for any cameras, then it will be removed from those camera lists, and the replacement will be added to those cameras in the same position as this node was.
replacement - the new node that replaces the current node in the scenegraph tree.public void raise()
public void raiseTo(ZNode afterNode)
If the specified node is null, then this node is raised to be the last node rendered of its siblings (i.e., equivalent to calling {link #raise}
afterNode - The node to raise this node after.public void lower()
public void lowerTo(ZNode beforeNode)
If the specified node is null, then this node is lowered to be the first node rendered of its siblings (i.e., equivalent to calling {link #lower}
beforeNode - The node to lower this node before.public java.util.Vector getCameras()
findCameras(),
findAllCameras()public java.util.Vector findCameras()
getCameras()public java.util.Vector findAllCameras()
getCameras()protected void helpFindAllCameras(java.util.Vector result)
public boolean isVolatile()
setVolatile(boolean), or if its visual component or any of its descendants are volatile.
Volatile objects are those objects that change regularly, such as an object
that is animated, or one whose rendering depends on its context. For instance,
a selection marker ZSelectionDecorator is always one-pixel thick, and thus its bounds
depend on the current magnification.
setVolatile(boolean)public void setVolatile(boolean v)
v - the new specification of whether this node is volatile.isVolatile()public void updateVolatility()
setVolatile(boolean),
isVolatile()public float getAlpha()
public void setAlpha(float alpha)
public boolean getVisible()
isVisible()public boolean isVisible()
getVisible()public void setVisible(boolean v)
v - Value of visible.public boolean getSave()
public void setSave(boolean s)
s - true if node should be savedpublic ZTransform getTransform()
public void setTransform(ZTransform v)
public void transformChanged(java.awt.geom.AffineTransform origTransform)
origTransform - The value of the original transform (before it was changed)public ZVisualComponent getVisualComponent()
public void setVisualComponent(ZVisualComponent vc)
vc - The new visual componentprotected void clearVisualComponent()
protected void setParent(ZNode parent)
throws ZOperationNotAllowedException
parent - public ZNode getParent()
addChild(ZNode)public float getMinMag()
public void setMinMag(float v)
v - The new minimumn magnification for this node.public float getMaxMag()
public void setMaxMag(float v)
v - The new maximum magnification for this node.public java.util.Vector getSelectedChildren()
protected java.awt.Composite createComposite(java.awt.Composite currentComposite,
float currentMag)
public void paint(ZRenderContext renderContext)
The node makes the guarantee that before anything is rendered, the transform, clip, and composite of the Graphics2D will be set properly. However, the color, font, and stroke are unset, and the visual component must set those things as needed. The visual components that are painted are not obligated to restore any aspect of the Graphics2D state.
renderContext - The graphics context to use for rendering.ZVisualComponent.paint(ZRenderContext)
public ZNode pick(java.awt.geom.Rectangle2D rect,
float mag)
rect - Coordinates of pick rectangle in camera coordinates.mag - The magnification of the camera being picked within.ZVisualComponent.isPickable()
public int findNodes(ZFindFilter filter,
java.util.Vector nodes)
filter - The filter that decides whether or not to include individual nodes in the find listnodes - the accumulation vector (results will be place here).ZVisualComponent.isFindable(),
ZFindFilterpublic ZNode findNode()
ZVisualComponent.findNode()public ZRootNode findRoot()
ZRootNodepublic ZVisualComponent findVisualComponent(java.lang.Class type)
type - the object class to look for.public void damage()
If this object is visible in multiple places on a surface because the surface has more than one camera where each camera can see this object, then this call to damage causes all of those places to be marked as needing to be repainted. A single call to that surface's restore method will cause all of those damaged areas to be repainted.
If this object is visible within multiple surfaces, then this call to damage causes those places that this object is visible on each surface to be marked as needing to be repainted. The restore method of each surface must be called in order to repaint the damaged area associated with this object.
Important note : There are two proper uses of damage.
damage(boolean).
ZSurface.restore(),
damage(boolean)public void damage(boolean boundsChanged)
If this object is visible in multiple places on a surface because the surface has more than one camera where each camera can see this object, then this call to damage causes all of those places to be marked as needing to be repainted. A single call to that surface's restore method will cause all of those damaged areas to be repainted.
If this object is visible within multiple surfaces, then this call to damage causes those places that this object is visible on each surface to be marked as needing to be repainted. The restore method of each surface must be called in order to repaint the damaged area associated with this object.
Important note : There are two proper uses of damage.
damage().
ZSurface.restore(),
damage()public void updateChildBounds()
ZScenegraphObject,
ZScenegraphObject.updateChildBounds()public void updateBounds()
This method invalidates the cached values for both the globalBounds and globalCompBounds. GlobalCompBounds consists of the bounding rectangle containing this nodes visual components. GlobalBounds consists of the bounding rectangle containing the globalCompBounds and all of this nodes descendents globalBounds. For a discussion on coordinate systems and bounds see ZScenegraphObject.
ZScenegraphObject,
ZScenegraphObject.updateBounds(),
updateGlobalCompBounds(),
updateGlobalBounds()public void updateGlobalCompBounds()
ZScenegraphObjectprotected void computeGlobalCompBounds()
ZScenegraphObjectpublic ZBounds getGlobalCompBounds()
ZScenegraphObject,
updateGlobalCompBounds(),
computeGlobalCompBounds()public ZBounds getCompBounds()
public void updateGlobalBounds()
ZScenegraphObjectprotected void computeGlobalBounds()
ZScenegraphObjectpublic ZBounds getGlobalBounds()
ZScenegraphObject,
updateGlobalBounds(),
computeGlobalBounds()public java.awt.geom.AffineTransform computeGlobalCoordinateFrame()
public java.util.Vector getObjs(java.awt.geom.Rectangle2D bounds)
public boolean isDescendent(ZNode queryNode)
queryNode - a possible ancenstor of nodepublic boolean isAncestor(ZNode queryNode)
queryNode - a possible descendent of nodepublic void selectAll(ZCamera camera)
public void unselectAll()
public void addProperty(java.lang.String key,
java.lang.Object value)
key - The key to the new property.value - The value of the new property.public void addProperty(ZProperty newProp)
property - The new property.public java.lang.Object getProperty(java.lang.String key)
public java.util.Vector getProperties()
public void writeObject(ZObjectOutputStream out)
throws java.io.IOException
out - The stream that this object writes into
public void writeObjectRecurse(ZObjectOutputStream out)
throws java.io.IOException
out - The stream that this object writes into
public void setState(java.lang.String fieldType,
java.lang.String fieldName,
java.lang.Object fieldValue)
fieldType - The fully qualified type of the fieldfieldName - The name of the fieldfieldValue - The value of the fieldpublic ZSerializable writeReplace()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||