|
Jazz API Documentation | |||||||||
| 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.ZVisualComponent
ZVisualComponent is the base class for objects that actually get rendered. A visual component primarily implements three methods: paint(), pick(), and computeBounds(). New sub-classes must override at least paint() and computeBounds(), and will often choose to override pick() as well.
| Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject |
bounds,
objRefTable,
volatileBounds_DEFAULT |
| Constructor Summary | |
ZVisualComponent()
Default constructor for visual component. |
|
| Method Summary | |
protected void |
boundsUpdated()
Internal method to notify the visual component that its bounds have been updated, and its parents should now update their bounds |
java.lang.Object |
clone()
Duplicates the current object by using the copy constructor. |
void |
duplicateObject(ZVisualComponent refVC)
Copies all object information from the reference object into the current object. |
ZNode[] |
getParents()
Return a copy of the array of parents of this node. |
void |
paint(java.awt.Graphics2D g2)
Renders this visual component. |
boolean |
pick(java.awt.geom.Rectangle2D rect,
ZSceneGraphPath path)
Determines whether the specified rectangle (in local coordinates) 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 |
render(ZRenderContext renderContext)
Renders this visual component. |
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)
This causes just the specified bounds of this visual component to be repainted. |
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 parents 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 |
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 edu.umd.cs.jazz.ZSceneGraphObject |
computeBounds,
dump,
duplicateObject,
getBounds,
getVolatileBounds,
reshape,
setVolatileBounds,
updateObjectReferences |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public ZVisualComponent()
| Method Detail |
public void duplicateObject(ZVisualComponent refVC)
refVC - The reference visual component to copypublic java.lang.Object clone()
ZSceneGraphObject.updateObjectReferences(edu.umd.cs.jazz.util.ZObjectReferenceTable)public void trimToSize()
protected void updateVolatility()
ZSceneGraphObject.setVolatileBounds(boolean),
ZSceneGraphObject.getVolatileBounds()public ZNode[] getParents()
public boolean pickBounds(java.awt.geom.Rectangle2D rect)
rect - the rectangle that this method tests for intersection with
public boolean pick(java.awt.geom.Rectangle2D rect,
ZSceneGraphPath path)
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 component in local coordinates.ZDrawingSurface.pick(int, int)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.
Note that a subclass can either extend this directly, or can just extend paint if it does not access to the render context.
renderContext - The graphics context to use for rendering.paint(Graphics2D)public void paint(java.awt.Graphics2D g2)
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.
Note that a subclass can either extend this directly, or can just render if it needs access to the render context for a more complex object.
Graphics2D - The graphics to render withrender(ZRenderContext)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.)
ZSceneGraphObject.reshape()public void repaint(ZBounds repaintBounds)
repaintBounds - The bounds to repaintrepaint()protected void updateBounds()
protected void boundsUpdated()
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
|
Jazz API Documentation | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||