|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.umd.cs.jazz.scenegraph.ZVisualComponent
ZVisualComponentDecorator| Field Summary | |
protected boolean |
cacheVolatile
|
protected boolean |
findable
|
static boolean |
findable_DEFAULT
|
protected boolean |
isVolatile
|
protected ZBounds |
localBounds
Bounds of this visual component relative to its coordinate frame. |
protected boolean |
localBoundsDirty
|
protected ZScenegraphObject |
parent
The parent of this visual component (or null if none). |
protected boolean |
pickable
|
static boolean |
pickable_DEFAULT
|
protected boolean |
selected
|
| Constructor Summary | |
ZVisualComponent()
Default constructor for visual component. |
|
ZVisualComponent(ZVisualComponent vc)
Constructs a new ZVisualComponent that is a copy of the specified component (i.e., a "copy constructor"). |
|
| Method Summary | |
java.lang.Object |
clone()
Duplicates the current visual component by using the copy constructor. |
protected void |
computeLocalBounds()
All sub-classes need to define this method to compute their local bounds. |
void |
damage()
|
void |
damage(boolean boundsChanged)
|
ZNode |
findNode()
Traverses the parents until it finds the ZNode that references
this visual component (or the decorator chain that leads to this component). |
ZVisualComponent |
findVisualComponent(java.lang.Class type)
Traverse the list of visual components (downwards), and return the first one that is of the specified Class, or null if none. |
ZBounds |
getLocalBounds()
Returns the local bounds of this component. |
ZScenegraphObject |
getParent()
Returns the parent of this component, or null if none. |
boolean |
isFindable()
Determines if this visual component is findable. |
boolean |
isPickable()
Determines if this visual component is pickable. |
boolean |
isSelected()
Determines if this component is selected. |
boolean |
isVolatile()
Determines if this visual component is volatile. |
void |
paint(ZRenderContext renderContext)
Paints this visual component. |
boolean |
pick(java.awt.geom.Rectangle2D rect)
Determines whether the specified rectangle should "pick" this visual component. |
boolean |
pickBounds(java.awt.geom.Rectangle2D rect)
This is a utility function to determine if the specified rectangle intersects the bounds of this visual component. |
void |
select(ZCamera camera)
Select this visual component by inserting a ZSelectionDecorator component just above this as a decorator. |
void |
select(ZSelectionDecorator selectionDecorator)
Select this visual component. |
void |
setFindable(boolean findable)
Specifies whether this visual component is findable. |
void |
setParent(ZScenegraphObject parent)
Sets the parent of this component. |
void |
setPickable(boolean pickable)
Specifies whether this visual component is pickable. |
void |
setSelected(boolean b,
ZCamera camera)
Specify if this component is selected. |
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 |
setVisualComponent(ZVisualComponent child)
This should never be called. |
void |
setVolatile(boolean v)
Specifies that this visual component is volatile. |
java.lang.String |
toString()
Generate a string that represents this object for debugging. |
void |
transformChanged(java.awt.geom.AffineTransform origTransform)
always a noop |
void |
unselect()
Unselect this visual component by searching its parents for a ZSelectionDecorator to remove. |
void |
updateBounds()
Notifies this component that it must recompute its bounds. |
void |
updateChildBounds()
Since a visual component does not have children, this method does nothing, but it may do something for other types of scenegraph objects. |
void |
updateLocalBounds()
Specifies that this component's cached local bounds are out of date, and should be recomputed before being accessed. |
void |
updateVolatility()
Internal method to compute and cache the volatility of a component, 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 |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final boolean pickable_DEFAULT
public static final boolean findable_DEFAULT
protected ZBounds localBounds
protected ZScenegraphObject parent
protected boolean selected
protected boolean pickable
protected boolean findable
protected boolean isVolatile
protected boolean cacheVolatile
protected boolean localBoundsDirty
| Constructor Detail |
public ZVisualComponent()
Most visual components will want to store their visual bounds, and so we allocate localBounds here. However, if a particular visual component is implemented by computing its bounds every time it is asked instead of allocating it, then it can free up the ZBounds allocated here.
public ZVisualComponent(ZVisualComponent vc)
Most visual components will want to store their visual bounds, and so we allocate localBounds here. However, if a particular visual component is implemented by computing its bounds every time it is asked instead of allocating it, then it can free up the ZBounds allocated here.
| Method Detail |
public java.lang.Object clone()
ZVisualComponent(ZVisualComponent)public void transformChanged(java.awt.geom.AffineTransform origTransform)
child - public boolean isVolatile()
setVolatile(boolean), or if 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)
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.
v - the new specification of whether this component is volatile.isVolatile()public void updateVolatility()
setVolatile(boolean),
isVolatile()public boolean isSelected()
public void setSelected(boolean b,
ZCamera camera)
b - true if the component should be selected, false otherwisecamera - the camera that the selection is rendered constant thickness withinZSelectionDecoratorpublic void select(ZCamera camera)
camera - the camera that the selection is rendered constant thickness withinZSelectionDecorator,
select(ZSelectionDecorator)public void select(ZSelectionDecorator selectionDecorator)
selectionDecorator - - the decorator that should wrap thisselect(ZCamera)public void unselect()
select(ZCamera),
select(ZSelectionDecorator)public ZScenegraphObject getParent()
public void setParent(ZScenegraphObject parent)
parent - The new parent of this visual componentZNode.addChild(edu.umd.cs.jazz.scenegraph.ZNode),
ZNode.removeChild(edu.umd.cs.jazz.scenegraph.ZNode)public boolean isPickable()
setPickable(boolean),
ZCamera.pick(edu.umd.cs.jazz.util.ZBounds),
ZNode.pick(java.awt.geom.Rectangle2D, float),
isFindable()public void setPickable(boolean pickable)
isPickable(),
ZCamera.pick(edu.umd.cs.jazz.util.ZBounds),
ZNode.pick(java.awt.geom.Rectangle2D, float),
isFindable()public boolean isFindable()
setFindable(boolean),
ZCamera.findNodes(edu.umd.cs.jazz.util.ZFindFilter),
ZNode.findNodes(edu.umd.cs.jazz.util.ZFindFilter, java.util.Vector),
isPickable()public void setFindable(boolean findable)
findable - True if this component should be findableisFindable(),
ZCamera.findNodes(edu.umd.cs.jazz.util.ZFindFilter),
ZNode.findNodes(edu.umd.cs.jazz.util.ZFindFilter, java.util.Vector),
isPickable()public boolean pickBounds(java.awt.geom.Rectangle2D rect)
rect - the rectangle that this method tests for intersection withpublic boolean pick(java.awt.geom.Rectangle2D rect)
The implementation of this pick method for the base visual component returns true if the rectangle intersects the bounds of the component. If a sub-class wants more detailed picking, then it must extend this class. For example, a circle may only consider itself to be picked if the pointer is within the circle - rather than within the rectangular bounds.
rect - The rectangle that is picking this visual componentpublic ZNode findNode()
ZNode that references
this visual component (or the decorator chain that leads to this component).public ZVisualComponent findVisualComponent(java.lang.Class type)
public void setVisualComponent(ZVisualComponent child)
public void paint(ZRenderContext renderContext)
It is guaranteed that the transform, clip, and composite of the Graphics2D will be set properly for this component. However, the color, font, and stroke are unset, and the visual component must set those things as needed. The visual component is not obligated to restore any aspect of the Graphics2D state.
renderContext - The graphics context to use for rendering.paint(ZRenderContext)public void damage()
public void damage(boolean boundsChanged)
public void updateBounds()
computeLocalBounds()public void updateChildBounds()
ZNode.updateChildBounds()public void updateLocalBounds()
protected void computeLocalBounds()
Note that this method is not typically called directly by application writers, but if it is called, then the caller must clear the dirty bit which records the fact that the stored bounds is up to date. Do this with: localBoundsDirty = false
getLocalBounds()public ZBounds getLocalBounds()
computeLocalBounds() first.public java.lang.String toString()
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 field
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||