|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | 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 ZSceneGraphEditorFactory |
editorFactory |
static boolean |
findable_DEFAULT |
ZGroup |
parent This node's parent. |
static boolean |
pickable_DEFAULT |
static boolean |
savable_DEFAULT |
static boolean |
selectable_DEFAULT |
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject |
bounds, inTransaction, invalidBounds, invalidVolatileBounds, listenerList, volatileBounds, volatileBounds_DEFAULT |
Constructor Summary | |
ZNode() Constructs a new ZNode. |
Method Summary | |
void |
addNodeListener(ZNodeListener l) Adds the specified node listener to receive node events from this node. |
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. |
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.Dimension2D aDimension) Transform the specified dimension (in global coordinates) to local coordinates in this node's coordinate system. |
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.Dimension2D aDimension) Transform the specified dimension (in this node's local coordinates) to global coordinates. |
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 |
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 |
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 |
setVolatileBounds(boolean v) Specifies whether or not this node is volatile. |
protected void |
updateBounds() Internal method that causes this node and all of its ancestors to invalidate their bounds. |
protected void |
updateVolatility() Internal method that causes this node and all of its ancestors to invalidate their volatileBounds. |
void |
writeObject(ZObjectOutputStream out) Write out all of this object's state. |
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 |
Methods inherited from interface edu.umd.cs.jazz.io.ZSerializable |
writeObjectRecurse |
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
public static ZSceneGraphEditorFactory editorFactory
public ZGroup parent
Constructor Detail |
public ZNode()
Method Detail |
public void addNodeListener(ZNodeListener l)
l
- the node listenerprotected java.lang.Object duplicateObject()
duplicateObject
in class ZSceneGraphObject
ZSceneGraphObject.duplicateObject()
public ZSceneGraphEditor editor()
ZSceneGraphEditor
, ZSceneGraphEditorFactory
public void extract()
ZGroup.extract()
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
public ZBounds getGlobalBounds()
public java.awt.geom.AffineTransform getGlobalToLocalTransform()
public java.awt.geom.AffineTransform getLocalToGlobalTransform()
public final ZGroup getParent()
public ZRoot getRoot()
ZRoot
public double globalToLocal(java.awt.geom.Dimension2D aDimension)
NOTE: Dimension2D's are abstract. When creating a new Dimension2D for use with Jazz we recoment that you use edu.umd.cs.util.ZDimension instead of java.awt.Dimension. ZDimension uses doubles internally, while java.awt.Dimension uses integers.
localToGlobal(java.awt.geom.Dimension2D)
public double globalToLocal(java.awt.geom.Point2D pt)
localToGlobal(java.awt.geom.Dimension2D)
public double globalToLocal(java.awt.geom.Rectangle2D rect)
localToGlobal(java.awt.geom.Dimension2D)
public final boolean hasNodeListener()
public boolean isAncestorOf(ZNode queryNode)
queryNode
- a possible descendent of nodepublic boolean isDescendentOf(ZNode queryNode)
queryNode
- a possible ancenstor of nodepublic final boolean isFindable()
public final boolean isPickable()
public final boolean isSavable()
public final boolean isSelectable()
public double localToGlobal(java.awt.geom.Dimension2D aDimension)
NOTE: Dimension2D's are abstract. When creating a new Dimension2D for use with Jazz we recoment that you use edu.umd.cs.util.ZDimension instead of java.awt.Dimension. ZDimension uses doubles internally, while java.awt.Dimension uses integers.
globalToLocal(java.awt.geom.Dimension2D)
public double localToGlobal(java.awt.geom.Point2D pt)
globalToLocal(java.awt.geom.Dimension2D)
public double localToGlobal(java.awt.geom.Rectangle2D rect)
globalToLocal(java.awt.geom.Dimension2D)
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.protected void percolateEventUpSceneGraph(ZEvent anEvent)
EventListenerList
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)
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 remove()
public void removeNodeListener(ZNodeListener l)
l
- the node listenerpublic 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 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)
repaint
in class ZSceneGraphObject
repaintBounds
- The bounds to repaintZSceneGraphObject.reshape()
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 true node addition or removal. A modification event is one in which a node changes position in a single scenegraph or between two different scenegraphs. A true addition or removal event is one in which a node is first added to or removed from a scenegraph.
newParent
- The new parent of this node.ZGroupEvent
public void replaceWith(ZNode replacement)
replacement
- the new node that replaces the current node in the scenegraph tree.public static void setEditorFactory(ZSceneGraphEditorFactory factory)
factory
- The new factory to create editors with.editor()
public void setFindable(boolean findable)
findable
- True if this node should be findable.public void setParent(ZGroup newParent)
newParent
- The new parent of this node.public void setPickable(boolean pickable)
pickable
- True if this node should be pickable.public void setSavable(boolean s)
s
- true if node should be savedpublic void setSelectable(boolean selectable)
public 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 fieldprotected void updateBounds()
updateBounds
in class ZSceneGraphObject
protected void updateVolatility()
updateVolatility
in class ZSceneGraphObject
setVolatileBounds(boolean)
, ZSceneGraphObject.getVolatileBounds()
public void setVolatileBounds(boolean v)
Volatile objects are those objects that change regularly, such as an object that is animated, or one whose rendering depends on its context.
setVolatileBounds
in class ZSceneGraphObject
v
- the new specification of whether this node is volatile.ZSceneGraphObject.getVolatileBounds()
public void writeObject(ZObjectOutputStream out) throws java.io.IOException
writeObject
in interface ZSerializable
writeObject
in class ZSceneGraphObject
out
- The stream that this object writes intojava.io.IOException
public ZSerializable writeReplace()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |