|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.ZSceneGraphObject | +--edu.umd.cs.jazz.ZNode
ZNode is the common superclass of all objects in a Jazz scenegraph. It has very limited functionality, and primarily exists to support sub-classes.
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.
Field Summary | |
static boolean |
findable_DEFAULT
|
static boolean |
pickable_DEFAULT
|
static boolean |
savable_DEFAULT
|
static boolean |
selectable_DEFAULT
|
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject |
bounds, listenerList, volatileBounds, volatileBounds_DEFAULT |
Constructor Summary | |
ZNode()
Constructs a new ZNode. |
Method Summary | |
protected void |
addClientProperty(ZProperty prop)
Internal method to add the specified property. |
void |
addNodeListener(ZNodeListener l)
Adds the specified node listener to receive node events from this node. |
java.lang.String |
dump()
Generate a string that represents this object for debugging. |
protected java.lang.Object |
duplicateObject()
Returns a clone of this object. |
ZSceneGraphEditor |
editor()
This returns a new instance of a ZSceneGraphEditor for this node. |
void |
extract()
Extract this node from the tree, merging back in any children. |
protected int |
findNodes(ZFindFilter filter,
java.util.ArrayList nodes)
Internal method used to return the list of nodes that are accepted by the specified filter in the subtree rooted with this. |
java.lang.Object |
getClientProperty(java.lang.Object key)
Returns the value of the property with the specified key. |
ZBounds |
getGlobalBounds()
Return a copy of the bounds of the subtree rooted at this node in global coordinates. |
java.awt.geom.AffineTransform |
getGlobalToLocalTransform()
Return the transform that converts global coordinates at the root node to local coordinates at this node. |
java.awt.geom.AffineTransform |
getLocalToGlobalTransform()
Return the transform that converts local coordinates at this node to global coordinates at the root node. |
ZGroup |
getParent()
Get the node's parent. |
ZRoot |
getRoot()
Traverse the tree, find the root node, and return it. |
double |
globalToLocal(java.awt.geom.Point2D pt)
Transform the specified point (in global coordinates) to local coordinates in this node's coordinate system. |
double |
globalToLocal(java.awt.geom.Rectangle2D rect)
Transform the specified rectangle (in global coordinates) to local coordinates in this node's coordinate system. |
boolean |
hasNodeListener()
Determines if this node has a node listener. |
boolean |
isAncestorOf(ZNode queryNode)
Method to determine if this is an ancenstor of queryNode. |
boolean |
isDescendentOf(ZNode queryNode)
Method to determine if this is a descendent of queryNode. |
boolean |
isFindable()
Determines if this node is findable. |
boolean |
isPickable()
Determines if this node is pickable. |
boolean |
isSavable()
Determine if this node gets saved when written out. |
boolean |
isSelectable()
Determines if this node is selectable. |
double |
localToGlobal(java.awt.geom.Point2D pt)
Transform the specified point (in this node's local coordinates) to global coordinates. |
double |
localToGlobal(java.awt.geom.Rectangle2D rect)
Transform the specified rectangle (in this node's local coordinates) to global coordinates. |
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. |
protected void |
percolateEventUpSceneGraph(ZEvent anEvent)
Notifies all listeners that have registered interest for notification on this event type, percolate up the scenegraph looking for listeners. |
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 |
putClientProperty(java.lang.Object key,
java.lang.Object value)
Add an arbitrary key/value "client property" to this component. |
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 |
remove()
Remove this node, and any subtree, from the scenegraph. |
void |
removeNodeListener(ZNodeListener l)
Removes the specified node listener so that it no longer receives node events from this node. |
void |
render(ZRenderContext renderContext)
Renders this node. |
void |
repaint()
Repaint causes the portions of the surfaces that this object appears in to be marked as needing painting, and queues events to cause those areas to be painted. |
void |
repaint(ZBounds repaintBounds)
Method to pass repaint methods up the tree. |
void |
repaint(ZSceneGraphObject obj,
java.awt.geom.AffineTransform at,
ZBounds clipBounds)
Method to pass repaint methods up the tree. |
void |
reparent(ZGroup newParent)
Set the parent of this node, and transform the node in such a way that it doesn't move in global coordinates. |
void |
replaceWith(ZNode replacement)
Swaps this node out of the scenegraph tree, and replaces it with the specified replacement node. |
static void |
setEditorFactory(ZSceneGraphEditorFactory factory)
Define how editors should be created. |
void |
setFindable(boolean findable)
Specifies whether this node is findable. |
void |
setParent(ZGroup newParent)
Set the parent of this node. |
void |
setPickable(boolean pickable)
Specifies whether this node is pickable. |
void |
setSavable(boolean s)
Specify if this node should be saved. |
void |
setSelectable(boolean selectable)
Specifies whether this node is selectable. |
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 |
trimToSize()
Trims the capacity of the array that stores the clientProperties list points to the actual number of points. |
protected void |
updateBounds()
Internal method that causes this node and all of its ancestors to recompute their bounds. |
protected void |
updateObjectReferences(ZObjectReferenceTable objRefTable)
Called to update internal object references after a clone operation by ZSceneGraphObject.clone() . |
protected 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 edu.umd.cs.jazz.ZSceneGraphObject |
addMouseListener, addMouseMotionListener, clone, computeBounds, fireEvent, fireMouseEvent, getBounds, getBoundsReference, getListenerList, getVolatileBounds, hasLisenerOfType, hasMouseListener, processMouseEvent, removeEventListener, removeMouseListener, removeMouseMotionListener, reshape, setBounds, setVolatileBounds |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean savable_DEFAULT
public static final boolean pickable_DEFAULT
public static final boolean findable_DEFAULT
public static final boolean selectable_DEFAULT
Constructor Detail |
public ZNode()
Method Detail |
protected java.lang.Object duplicateObject()
duplicateObject
in class ZSceneGraphObject
ZSceneGraphObject.duplicateObject()
protected void updateObjectReferences(ZObjectReferenceTable objRefTable)
ZSceneGraphObject.clone()
.updateObjectReferences
in class ZSceneGraphObject
ZSceneGraphObject.updateObjectReferences(edu.umd.cs.jazz.util.ZObjectReferenceTable)
public void trimToSize()
public static void setEditorFactory(ZSceneGraphEditorFactory factory)
factory
- The new factory to create editors with.editor()
public ZSceneGraphEditor editor()
ZSceneGraphEditor
,
ZSceneGraphEditorFactory
public void addNodeListener(ZNodeListener l)
l
- the node listenerpublic void removeNodeListener(ZNodeListener l)
l
- the node listenerpublic void remove()
public void extract()
ZGroup.extract()
public void replaceWith(ZNode replacement)
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 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 lower()
beforeNode
- The node to lower this node before.public void setParent(ZGroup newParent)
newParent
- The new parent of this node.public void reparent(ZGroup newParent)
This method may fire NODE_ADDED or NODE_REMOVED ZGroupEvents.
ZGroupEvents now contain a method isModificationEvent()
to
distinguish a modification event from a
newParent
- The new parent of this node.ZGroupEvent
public final ZGroup getParent()
protected void updateVolatility()
updateVolatility
in class ZSceneGraphObject
ZSceneGraphObject.setVolatileBounds(boolean)
,
ZSceneGraphObject.getVolatileBounds()
public final boolean isSavable()
public void setSavable(boolean s)
s
- true if node should be savedpublic void setPickable(boolean pickable)
pickable
- True if this node should be pickable.public final boolean isPickable()
public void setFindable(boolean findable)
findable
- True if this node should be findable.public final boolean isFindable()
public void setSelectable(boolean selectable)
findable
- True if this node should be selectable.public final boolean isSelectable()
public final boolean hasNodeListener()
public void render(ZRenderContext renderContext)
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.
renderContext
- The graphics context to use for rendering.public ZBounds getGlobalBounds()
public double globalToLocal(java.awt.geom.Point2D pt)
localToGlobal(java.awt.geom.Point2D)
public double globalToLocal(java.awt.geom.Rectangle2D rect)
localToGlobal(java.awt.geom.Point2D)
public double localToGlobal(java.awt.geom.Point2D pt)
globalToLocal(java.awt.geom.Point2D)
public double localToGlobal(java.awt.geom.Rectangle2D rect)
globalToLocal(java.awt.geom.Point2D)
public java.awt.geom.AffineTransform getLocalToGlobalTransform()
public java.awt.geom.AffineTransform getGlobalToLocalTransform()
public void repaint()
Scenegraph objects should call repaint when their internal state has changed and they need to be redrawn on the screen.
Important note : Scenegraph objects should call reshape() instead of repaint() if the internal state change effects the bounds of the shape in any way (e.g. changing penwidth, selection, transform, adding points to a line, etc.)
repaint
in class ZSceneGraphObject
ZSceneGraphObject.reshape()
public void repaint(ZBounds repaintBounds)
repaintBounds
- The bounds to repaintpublic void repaint(ZSceneGraphObject obj, java.awt.geom.AffineTransform at, ZBounds clipBounds)
obj
- The object to repaintat
- The affine transformclipBounds
- The bounds to clip to when repaintingprotected void updateBounds()
updateBounds
in class ZSceneGraphObject
public boolean pick(java.awt.geom.Rectangle2D rect, ZSceneGraphPath path)
rect
- Coordinates of pick rectangle in local coordinatespath
- The path through the scenegraph to the picked node. Modified by this call.ZDrawingSurface.pick(int, int)
protected int findNodes(ZFindFilter filter, java.util.ArrayList nodes)
filter
- The filter that decides whether or not to include individual nodes in the find listnodes
- the accumulation list (results will be place here).isFindable()
,
ZFindFilter
protected void percolateEventUpSceneGraph(ZEvent anEvent)
id
- The event id (BOUNDS_CHANGED or GLOBAL_BOUNDS_CHANGED)node
- The node being affected.EventListenerList
public ZRoot getRoot()
ZRoot
public boolean isDescendentOf(ZNode queryNode)
queryNode
- a possible ancenstor of nodepublic boolean isAncestorOf(ZNode queryNode)
queryNode
- a possible descendent of nodepublic void putClientProperty(java.lang.Object key, java.lang.Object value)
The
If value is null this method will remove the property.get/putClientProperty
methods provide access to
a small per-instance hashtable. Callers can use get/putClientProperty
to annotate components that were created by another module.
getClientProperty(java.lang.Object)
protected void addClientProperty(ZProperty prop)
prop
- The new property.public java.lang.Object getClientProperty(java.lang.Object key)
putClientProperty
will return
a non-null value.putClientProperty(java.lang.Object, java.lang.Object)
public java.lang.String dump()
dump
in class ZSceneGraphObject
ZDebug.dump(edu.umd.cs.jazz.ZNode)
public void writeObject(ZObjectOutputStream out) throws java.io.IOException
writeObject
in interface ZSerializable
writeObject
in class ZSceneGraphObject
out
- The stream that this object writes intopublic void writeObjectRecurse(ZObjectOutputStream out) throws java.io.IOException
writeObjectRecurse
in interface ZSerializable
writeObjectRecurse
in class ZSceneGraphObject
out
- The stream that this object writes intopublic void setState(java.lang.String fieldType, java.lang.String fieldName, java.lang.Object fieldValue)
setState
in interface ZSerializable
setState
in class ZSceneGraphObject
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 |