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, inTransaction, invalidBounds, invalidVolatileBounds, 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)
          Deprecated. As of Jazz version 1.3, replaced by ZHandle.handleDragged(double x, double y, ZMouseEvent aEvent).
 void handleDragged(double dx, double dy, ZMouseEvent aEvent)
          Called by the managing ZHandleGroup when appropriate.
 void handleEndDrag(double x, double y)
          Deprecated. As of Jazz version 1.3, replaced by ZHandle.handleEndDrag(double x, double y, ZMouseEvent aEvent).
 void handleEndDrag(double x, double y, ZMouseEvent aEvent)
          Called by the managing ZHandleGroup when appropriate.
 void handleStartDrag(double x, double y)
          Deprecated. As of Jazz version 1.3, replaced by ZHandle.handleStartDrag(double x, double y, ZMouseEvent aEvent).
 void handleStartDrag(double x, double y, ZMouseEvent aEvent)
          Called by the managing ZHandleGroup when appropriate.
 boolean isHighlighted()
          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 setIsHighlighted(boolean aBoolean)
          Mark this handles as highlighted if true, not highlighted if false.
 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, computeVolatileBounds, dump, duplicateObject, endTransaction, fireEvent, fireMouseEvent, getBounds, getBoundsReference, getClientProperty, getHandles, getListenerList, getVolatileBounds, hasLisenerOfType, hasListenerOfType, hasMouseListener, markInTransaction, markNotInTransaction, processMouseEvent, putClientProperty, removeEventListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, reshape, setBounds, setState, setVolatileBounds, startTransaction, 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.


setIsHighlighted

public void setIsHighlighted(boolean aBoolean)
Mark this handles as highlighted if true, not highlighted if false.


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)
Deprecated. As of Jazz version 1.3, replaced by ZHandle.handleStartDrag(double x, double y, ZMouseEvent aEvent).

Called by the managing ZHandleGroup when appropriate. Customs handles can override this method to learn when a drag has started.


handleDragged

public void handleDragged(double dx,
                          double dy)
Deprecated. As of Jazz version 1.3, replaced by ZHandle.handleDragged(double x, double y, ZMouseEvent aEvent).

Called by the managing ZHandleGroup when appropriate. Customs handles can override this method to learn when a drag has occurred.


handleEndDrag

public void handleEndDrag(double x,
                          double y)
Deprecated. As of Jazz version 1.3, replaced by ZHandle.handleEndDrag(double x, double y, ZMouseEvent aEvent).

Called by the managing ZHandleGroup when appropriate. Customs handles can override this method to learn when a drag has ended.


handleStartDrag

public void handleStartDrag(double x,
                            double y,
                            ZMouseEvent aEvent)
Called by the managing ZHandleGroup when appropriate. Customs handles can override this method to learn when a drag has started.

Parameters:
x - The x coord of the drag start in local coords of the ZHandleGroup.
y - The y coord of the drag start in local coords of the ZHandleGroup.
aEvent - The source mouse event that caused the start drag.

handleDragged

public void handleDragged(double dx,
                          double dy,
                          ZMouseEvent aEvent)
Called by the managing ZHandleGroup when appropriate. Customs handles can override this method to learn when a drag has occurred.

Parameters:
dx - The change in the x coord of the drag in local coords of the ZHandleGroup.
dy - The change in the y coord of the drag in local coords of the ZHandleGroup.
aEvent - The source mouse event that caused the drag.

handleEndDrag

public void handleEndDrag(double x,
                          double y,
                          ZMouseEvent aEvent)
Called by the managing ZHandleGroup when appropriate. Customs handles can override this method to learn when a drag has ended.

Parameters:
x - The x coord of the end drag in local coords of the ZHandleGroup.
y - The y coord of the end drag in local coords of the ZHandleGroup.
aEvent - The source mouse event that caused the end drag.


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