edu.umd.cs.jazz.component
Class ZBasicVisualComponent

java.lang.Object
  |
  +--edu.umd.cs.jazz.ZSceneGraphObject
        |
        +--edu.umd.cs.jazz.ZVisualComponent
              |
              +--edu.umd.cs.jazz.component.ZBasicVisualComponent
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, ZAppearance, ZFillColor, ZFillPaint, ZPenColor, ZPenPaint, ZSerializable, ZStroke
Direct Known Subclasses:
ZShape

public class ZBasicVisualComponent
extends ZVisualComponent
implements ZStroke, ZPenPaint, ZFillPaint, ZPenColor, ZFillColor

This class is designed to be extended. It takes care of managing a fillPaint, a penPaint, and a stroke, but leaves picking, and rendering to its subclasses.

Author:
Jesse Grosjean
See Also:
Serialized Form

Field Summary
protected  boolean absPenWidth
          Current absolute pen width.
static boolean DEFAULT_ABS_PEN_WIDTH
          Default absolute pen width.
static java.awt.Paint DEFAULT_FILL_PAINT
          Default fill paint.
static java.awt.Paint DEFAULT_PEN_PAINT
          Default pen paint.
static double DEFAULT_PEN_WIDTH
          Default pen width.
static java.awt.Stroke DEFAULT_STROKE
          Default stroke.
protected  java.awt.Paint fillPaint
          Current fill paint.
protected  java.awt.Paint penPaint
          Current pen paint.
protected  double penWidth
          Current pen width.
protected  java.awt.BasicStroke stroke
          Current stroke.
 
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject
bounds, listenerList, volatileBounds, volatileBounds_DEFAULT
 
Constructor Summary
ZBasicVisualComponent()
          ZBasicVisualComponent constructor comment.
 
Method Summary
protected  java.lang.Object duplicateObject()
          Returns a clone of this object.
 double getAbsPenWidth()
          Get the absolute width of the pen used to draw the visual component.
 java.awt.Color getFillColor()
          Deprecated. As of Jazz version 1.1, replaced by ZFillPaint.getFillPaint().
 java.awt.Paint getFillPaint()
          Get the fill paint of this visual component.
 java.awt.Color getPenColor()
          Deprecated. As of Jazz version 1.1, replaced by ZPenPaint.getPenPaint().
 java.awt.Paint getPenPaint()
          Get the pen paint of this visual component.
 double getPenWidth()
          Get the width of the pen used to draw the visual component.
protected  double getPenWidthForCurrentContext()
          Get the width of the pen used to draw the visual component while taking the current render context into consideration.
 java.awt.Stroke getStroke()
          Get the stroke used to draw the visual component.
 void setAbsPenWidth(double width)
          Set the absolute width of the pen used to draw the perimeter of this shape.
 void setFillColor(java.awt.Color color)
          Set the fill color of this visual component.
 void setFillPaint(java.awt.Paint aPaint)
          Set the fill paint of this visual component.
 void setPenColor(java.awt.Color color)
          Deprecated. As of Jazz version 1.1, replaced by ZPenPaint.setPenPaint(Paint aPaint).
 void setPenPaint(java.awt.Paint aPaint)
          Set the pen paint of this visual component.
 void setPenWidth(double width)
          Set the width of the pen used to draw the visual component.
 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 setStroke(java.awt.Stroke stroke)
          Set the stroke used to draw the visual component.
 void writeObject(ZObjectOutputStream out)
          Write out all of this object's state.
 
Methods inherited from class edu.umd.cs.jazz.ZVisualComponent
addParent, getNumParents, getParents, getParentsReference, getRoot, paint, pick, pickBounds, removeParent, render, repaint, repaint, trimToSize, updateBounds, updateObjectReferences, updateParentBounds, updateVolatility, writeObjectRecurse
 
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject
addMouseListener, addMouseMotionListener, clone, computeBounds, dump, 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

DEFAULT_PEN_WIDTH

public static final double DEFAULT_PEN_WIDTH
Default pen width.

DEFAULT_ABS_PEN_WIDTH

public static final boolean DEFAULT_ABS_PEN_WIDTH
Default absolute pen width.

DEFAULT_PEN_PAINT

public static final java.awt.Paint DEFAULT_PEN_PAINT
Default pen paint.

DEFAULT_FILL_PAINT

public static final java.awt.Paint DEFAULT_FILL_PAINT
Default fill paint.

DEFAULT_STROKE

public static final java.awt.Stroke DEFAULT_STROKE
Default stroke.

fillPaint

protected transient java.awt.Paint fillPaint
Current fill paint.

penPaint

protected transient java.awt.Paint penPaint
Current pen paint.

stroke

protected transient java.awt.BasicStroke stroke
Current stroke.

penWidth

protected double penWidth
Current pen width.

absPenWidth

protected boolean absPenWidth
Current absolute pen width.
Constructor Detail

ZBasicVisualComponent

public ZBasicVisualComponent()
ZBasicVisualComponent constructor comment.
Method Detail

duplicateObject

protected java.lang.Object duplicateObject()
Returns a clone of this object.
Overrides:
duplicateObject in class ZVisualComponent
See Also:
ZSceneGraphObject.duplicateObject()

getAbsPenWidth

public double getAbsPenWidth()
Get the absolute width of the pen used to draw the visual component. If the pen width is not absolute (dependent on magnification), then this returns 0.
Specified by:
getAbsPenWidth in interface ZStroke
Returns:
the pen width.
See Also:
getPenWidth()

getFillColor

public java.awt.Color getFillColor()
Deprecated. As of Jazz version 1.1, replaced by ZFillPaint.getFillPaint().

Get the fill color of this visual component.
Specified by:
getFillColor in interface ZFillColor
Returns:
the fill color, or null if none.

getFillPaint

public java.awt.Paint getFillPaint()
Get the fill paint of this visual component.
Specified by:
getFillPaint in interface ZFillPaint
Returns:
the fill paint, or null if none.

getPenColor

public java.awt.Color getPenColor()
Deprecated. As of Jazz version 1.1, replaced by ZPenPaint.getPenPaint().

Get the pen color of this visual component.
Specified by:
getPenColor in interface ZPenColor
Returns:
the pen color, or null if none.

getPenPaint

public java.awt.Paint getPenPaint()
Get the pen paint of this visual component.
Specified by:
getPenPaint in interface ZPenPaint
Returns:
the pen paint, or null if none.

getPenWidth

public double getPenWidth()
Get the width of the pen used to draw the visual component. If the pen width is absolute (independent of magnification), then this returns 0.
Specified by:
getPenWidth in interface ZStroke
Returns:
the pen width.
See Also:
getAbsPenWidth()

getPenWidthForCurrentContext

protected double getPenWidthForCurrentContext()
Get the width of the pen used to draw the visual component while taking the current render context into consideration. If the pen width is absolute (independent of magnification) then the resulting width will be scaled appropriately for the current context.
Returns:
the pen width scale for current context.

getStroke

public java.awt.Stroke getStroke()
Get the stroke used to draw the visual component.
Specified by:
getStroke in interface ZStroke
Returns:
the stroke.

setAbsPenWidth

public void setAbsPenWidth(double width)
Set the absolute width of the pen used to draw the perimeter of this shape.
Specified by:
setAbsPenWidth in interface ZStroke
Parameters:
width - the pen width.

setFillColor

public void setFillColor(java.awt.Color color)
Set the fill color of this visual component.
Specified by:
setFillColor in interface ZFillColor
Parameters:
color - the fill color, or null if none.

setFillPaint

public void setFillPaint(java.awt.Paint aPaint)
Set the fill paint of this visual component.
Specified by:
setFillPaint in interface ZFillPaint
Parameters:
aPaint - the fill paint, or null if none.

setPenColor

public void setPenColor(java.awt.Color color)
Deprecated. As of Jazz version 1.1, replaced by ZPenPaint.setPenPaint(Paint aPaint).

Set the pen color of this visual component.
Specified by:
setPenColor in interface ZPenColor
Parameters:
color - the pen color, or null if none.

setPenPaint

public void setPenPaint(java.awt.Paint aPaint)
Set the pen paint of this visual component.
Specified by:
setPenPaint in interface ZPenPaint
Parameters:
aPaint - the pen paint, or null if none.

setPenWidth

public void setPenWidth(double width)
Set the width of the pen used to draw the visual component. If the pen width is set here, then the stroke is set to solid (un-dashed), with a "butt" cap style, and a "bevel" join style. The pen width will be dependent on the camera magnification.
Specified by:
setPenWidth in interface ZStroke
Parameters:
width - the pen width.
See Also:
setAbsPenWidth(double)

setStroke

public void setStroke(java.awt.Stroke stroke)
Set the stroke used to draw the visual component.
Specified by:
setStroke in interface ZStroke
Parameters:
stroke - the stroke.

setState

public 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. After the object is created with its default no-arg constructor, this method will be called on the object once for each bit of state that was written out through calls to ZObjectOutputStream.writeState() within the writeObject method.
Overrides:
setState in class ZVisualComponent
Parameters:
fieldType - The fully qualified type of the field
fieldName - The name of the field
fieldValue - The value of the field

writeObject

public void writeObject(ZObjectOutputStream out)
                 throws java.io.IOException
Write out all of this object's state.
Overrides:
writeObject in class ZVisualComponent
Parameters:
out - The stream that this object writes into


Copyright © 2001 by University of Maryland, College Park, MD 20742, USA All rights reserved.