edu.umd.cs.jazz
Class ZHandle

java.lang.Object
  |
  +--edu.umd.cs.jazz.ZSceneGraphObject
        |
        +--edu.umd.cs.jazz.ZHandle
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, ZSerializable

public class ZHandle
extends ZSceneGraphObject

ZHandles are used to modify jazz object using direct manipulation. A scene graph object that wants to supply a set of custom handles should override the method getHandles. See the class ZRectangle for an example of providing a set of custom handles.

ZHandles should be located on the scene graph object that they manipulate. For example a handle to resize a rectangle might be located on the bottom right corner of that rectangle. Each time a handle is asked to compute its bounds it is expected to relocate itself using the coordinate system of the scene graph object that it is manipulating. To do this it uses a ZLocator object. ZLocators return a point on a scene graph object.

Author:
Jesse Grosjean
See Also:
Serialized Form

Field Summary
static java.awt.Paint DEFAULT_FILL_PAINT
           
static double DEFAULT_HANDLE_SIZE
           
static java.awt.Paint DEFAULT_HIGHLIGHT_FILL_PAINT
           
static java.awt.Paint DEFAULT_HIGHLIGHT_PEN_PAINT
           
static java.awt.Paint DEFAULT_PEN_PAINT
           
static java.awt.Stroke DEFAULT_STROKE
           
 
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject
bounds, listenerList, volatileBounds, volatileBounds_DEFAULT
 
Constructor Summary
ZHandle(ZLocator aLocator)
          Create a new handle that will use the aLocator parameter to locate itself.
 
Method Summary
 void computeBounds()
          Compute the bounds of this handle using the handles locator to determine the center point of the bounds and the DEFAULT_HANDLE_SIZE to determine the extent.
 ZHandleGroup getHandleGroup()
          Return the handle group that is managing this handle in the scene graph.
 ZLocator getLocator()
          Return the locator that the handle uses to locate itself when it computes its bounds.
 void handleDragged(double dx, double dy)
          The handle group that is managing this handle in the scene graph is responsible for calling this method when appropriate.
 void handleEndDrag(double x, double y)
          The handle group that is managing this handle in the scene graph is responsible for calling this method when appropriate.
 void handleStartDrag(double x, double y)
          The handle group that is managing this handle in the scene graph is responsible for calling this method when appropriate.
 boolean isHighlighted()
          Return true if the handle is highlighted.
 void isHighlighted(boolean aBoolean)
          Return true if the handle is highlighted.
 void render(ZRenderContext aRenderContext)
          Render the handle using the default values for fill paint, pen paint, size and stroke.
static void setDefaultFillPaint(java.awt.Paint aFillPaint)
          Set the default fill paint for handles.
static void setDefaultHandleSize(double aHandleSize)
          Set the default size for all handles.
static void setDefaultHighlightFillPaint(java.awt.Paint aHighlightFillPaint)
          Set the default highlight paint for handles.
static void setDefaultHighlightPenPaint(java.awt.Paint aHighlightPenPaint)
          Set the default highlight pen paint for handles.
static void setDefaultPenPaint(java.awt.Paint aPenPaint)
          Set the default pen paint for handles.
static void setDefaultStroke(java.awt.Stroke aStroke)
          Set the default stroke for all handles.
 void setHandleGroup(ZHandleGroup aHandleGroup)
          Set the handle group that is managing this handle in the scene graph.
 void setLocator(ZLocator aLocator)
          Set the locator that the handle uses to locate itself when it computes its bounds.
 
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject
addClientProperty, addMouseListener, addMouseMotionListener, clone, dump, duplicateObject, fireEvent, fireMouseEvent, getBounds, getBoundsReference, getClientProperty, getHandles, getListenerList, getVolatileBounds, hasLisenerOfType, hasMouseListener, processMouseEvent, putClientProperty, removeEventListener, removeMouseListener, removeMouseMotionListener, repaint, reshape, setBounds, setState, setVolatileBounds, trimToSize, updateBounds, updateObjectReferences, updateVolatility, writeObject, writeObjectRecurse
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILL_PAINT

public static java.awt.Paint DEFAULT_FILL_PAINT

DEFAULT_HIGHLIGHT_FILL_PAINT

public static java.awt.Paint DEFAULT_HIGHLIGHT_FILL_PAINT

DEFAULT_PEN_PAINT

public static java.awt.Paint DEFAULT_PEN_PAINT

DEFAULT_HIGHLIGHT_PEN_PAINT

public static java.awt.Paint DEFAULT_HIGHLIGHT_PEN_PAINT

DEFAULT_HANDLE_SIZE

public static double DEFAULT_HANDLE_SIZE

DEFAULT_STROKE

public static java.awt.Stroke DEFAULT_STROKE
Constructor Detail

ZHandle

public ZHandle(ZLocator aLocator)
Create a new handle that will use the aLocator parameter to locate itself.
Method Detail

setDefaultFillPaint

public static void setDefaultFillPaint(java.awt.Paint aFillPaint)
Set the default fill paint for handles. All handles in the system will be filled with this paint the next time they are repainted.

setDefaultHighlightFillPaint

public static void setDefaultHighlightFillPaint(java.awt.Paint aHighlightFillPaint)
Set the default highlight paint for handles. All handles in the system will be filled with this paint next time they are highlighted.

setDefaultPenPaint

public static void setDefaultPenPaint(java.awt.Paint aPenPaint)
Set the default pen paint for handles. All handles in the system will be drawn with this paint the next time they are repainted.

setDefaultHighlightPenPaint

public static void setDefaultHighlightPenPaint(java.awt.Paint aHighlightPenPaint)
Set the default highlight pen paint for handles. All handles in the system will be drawn with this paint next time they are highlighted.

setDefaultHandleSize

public static void setDefaultHandleSize(double aHandleSize)
Set the default size for all handles.

setDefaultStroke

public static void setDefaultStroke(java.awt.Stroke aStroke)
Set the default stroke for all handles.

computeBounds

public void computeBounds()
Compute the bounds of this handle using the handles locator to determine the center point of the bounds and the DEFAULT_HANDLE_SIZE to determine the extent.
Overrides:
computeBounds in class ZSceneGraphObject

isHighlighted

public boolean isHighlighted()
Return true if the handle is highlighted.

isHighlighted

public void isHighlighted(boolean aBoolean)
Return true if the handle is highlighted.

setLocator

public void setLocator(ZLocator aLocator)
Set the locator that the handle uses to locate itself when it computes its bounds.

getLocator

public ZLocator getLocator()
Return the locator that the handle uses to locate itself when it computes its bounds.

getHandleGroup

public ZHandleGroup getHandleGroup()
Return the handle group that is managing this handle in the scene graph.

setHandleGroup

public void setHandleGroup(ZHandleGroup aHandleGroup)
Set the handle group that is managing this handle in the scene graph.

render

public void render(ZRenderContext aRenderContext)
Render the handle using the default values for fill paint, pen paint, size and stroke.

handleStartDrag

public void handleStartDrag(double x,
                            double y)
The handle group that is managing this handle in the scene graph is responsible for calling this method when appropriate. When creating a custom handle you can override this method to learn when a drag has started.

handleDragged

public void handleDragged(double dx,
                          double dy)
The handle group that is managing this handle in the scene graph is responsible for calling this method when appropriate. When overriding this method you should remember to call super.handleDragged so that other handles have a chance to update their positions.

handleEndDrag

public void handleEndDrag(double x,
                          double y)
The handle group that is managing this handle in the scene graph is responsible for calling this method when appropriate. When creating a custom handle you can override this method to learn when a drag has ended.


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