edu.umd.cs.jazz.event
Class ZSelectionResizeHandler.ResizeHandles

java.lang.Object
  |
  +--edu.umd.cs.jazz.ZSceneGraphObject
        |
        +--edu.umd.cs.jazz.ZVisualComponent
              |
              +--edu.umd.cs.jazz.event.ZSelectionResizeHandler.ResizeHandles
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, java.io.Serializable, ZMouseListener, ZMouseMotionListener, ZSerializable
Enclosing class:
ZSelectionResizeHandler

protected class ZSelectionResizeHandler.ResizeHandles
extends ZVisualComponent
implements ZMouseListener, ZMouseMotionListener

Inner class used to render resize handles over a single component.

Terminology: A "compass position" is a pair of integers (x,y) drawn from the set {-1,0,1} that identifies a particular resize handle relative to a 3x3 square whose origin is the center. The upper-left resize handle is identified as (-1,-1), upper-right as (1,-1), etc.

See Also:
Serialized Form

Field Summary
protected  java.awt.geom.Point2D dragPt
          location of most recent drag, in global coordinates
protected  java.awt.geom.Rectangle2D[] handles
          actual rectangles rendered for the handles
protected  java.awt.Point highLightHandle
          the handle to highlight
protected  java.awt.Color penColor
          Pen color for rendering of selection
 java.awt.Color penColor_DEFAULT
          Default pen color
protected  java.awt.Point pressHandle
          relative compass location of resize handle of last press
protected  ZNode pressNode
          the node that was pressed
protected  java.awt.geom.Point2D pressPt
          location of most recent mouse press on a resize handle, in global coordinates.
protected  java.util.ArrayList selection
          The current selected list
 
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject
bounds, inTransaction, invalidBounds, invalidVolatileBounds, listenerList, volatileBounds, volatileBounds_DEFAULT
 
Constructor Summary
ZSelectionResizeHandler.ResizeHandles()
          Default constructor
 
Method Summary
protected  void computeBounds()
          The resize handles don't have logical bounds
 java.awt.Point contains(double x, double y)
          Used by ZSelectionResizeHandler to determine whether or not the mouse is over a resize handle.
 boolean contains(java.awt.geom.Rectangle2D rect)
          Used by ZSelectionResizeHandler to determine whether or not the mouse is over a resize handle.
protected  java.awt.geom.Rectangle2D getHandle(double cx, double cy, double xLen, double yLen)
          Render a single resize handle, centered at the given x,y position.
 void mouseClicked(ZMouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseDragged(ZMouseEvent e)
          Mouse drag event handler
 void mouseEntered(ZMouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(ZMouseEvent e)
          Invoked when the mouse exits a component.
 void mouseMoved(ZMouseEvent e)
          Invoked when the mouse button has been moved on a node (with no buttons no down).
 void mousePressed(ZMouseEvent e)
          Mouse press event handler
 void mouseReleased(ZMouseEvent e)
          Mouse release event handler
 boolean pick(java.awt.geom.Rectangle2D pickRect, ZSceneGraphPath path)
          Indicates a pick in case the underlying visual components aren't picked
 void render(ZRenderContext ctx)
          Renders the given ResizeHandles
 
Methods inherited from class edu.umd.cs.jazz.ZVisualComponent
addParent, duplicateObject, getNumParents, getParents, getParentsReference, getRoot, paint, pickBounds, removeParent, repaint, repaint, setState, trimToSize, updateBounds, updateObjectReferences, updateVolatility, writeObject, writeObjectRecurse
 
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject
addClientProperty, addMouseListener, addMouseMotionListener, clone, computeVolatileBounds, dump, endTransaction, fireEvent, fireMouseEvent, getBounds, getBoundsReference, getClientProperty, getHandles, getListenerList, getVolatileBounds, hasLisenerOfType, hasListenerOfType, hasMouseListener, markInTransaction, markNotInTransaction, processMouseEvent, putClientProperty, removeEventListener, removeMouseListener, removeMouseMotionListener, reshape, setBounds, setVolatileBounds, startTransaction
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

penColor_DEFAULT

public final java.awt.Color penColor_DEFAULT
Default pen color


penColor

protected java.awt.Color penColor
Pen color for rendering of selection


handles

protected java.awt.geom.Rectangle2D[] handles
actual rectangles rendered for the handles


pressPt

protected java.awt.geom.Point2D pressPt
location of most recent mouse press on a resize handle, in global coordinates.


pressNode

protected ZNode pressNode
the node that was pressed


pressHandle

protected java.awt.Point pressHandle
relative compass location of resize handle of last press


highLightHandle

protected java.awt.Point highLightHandle
the handle to highlight


dragPt

protected java.awt.geom.Point2D dragPt
location of most recent drag, in global coordinates


selection

protected java.util.ArrayList selection
The current selected list

Constructor Detail

ZSelectionResizeHandler.ResizeHandles

public ZSelectionResizeHandler.ResizeHandles()
Default constructor

Method Detail

pick

public boolean pick(java.awt.geom.Rectangle2D pickRect,
                    ZSceneGraphPath path)
Indicates a pick in case the underlying visual components aren't picked

Overrides:
pick in class ZVisualComponent
Parameters:
pickRect - The rectangle that is picking this visual component in local coordinates.
path - The path through the scenegraph to the picked node. Modified by this call.
Returns:
true if the rectangle picks this visual component
See Also:
ZDrawingSurface.pick(int, int)

getHandle

protected java.awt.geom.Rectangle2D getHandle(double cx,
                                              double cy,
                                              double xLen,
                                              double yLen)
Render a single resize handle, centered at the given x,y position.

Returns:
the newly allocated rectangle that represents the geometry of the handle.

render

public void render(ZRenderContext ctx)
Renders the given ResizeHandles

Overrides:
render in class ZVisualComponent
Parameters:
ctx - The current render context
See Also:
ZVisualComponent.paint(Graphics2D)

computeBounds

protected void computeBounds()
The resize handles don't have logical bounds

Overrides:
computeBounds in class ZSceneGraphObject

contains

public java.awt.Point contains(double x,
                               double y)
Used by ZSelectionResizeHandler to determine whether or not the mouse is over a resize handle. Tests the given (x,y) position to determine if it is over a resize handle. If so, sets cp to the compass position of the handle, and returns true. Otherwise returns false.

Parameters:
x - x position, in local coordinates
y - y position, in local coordinates
Returns:
cp out parameter: compass point of handle, if found.

contains

public boolean contains(java.awt.geom.Rectangle2D rect)
Used by ZSelectionResizeHandler to determine whether or not the mouse is over a resize handle. Tests the given rectangle to determine if it is contained by a resize handle.

Returns:
True if one of the handles contains the point

mousePressed

public void mousePressed(ZMouseEvent e)
Mouse press event handler

Specified by:
mousePressed in interface ZMouseListener

mouseDragged

public void mouseDragged(ZMouseEvent e)
Mouse drag event handler

Specified by:
mouseDragged in interface ZMouseMotionListener

mouseReleased

public void mouseReleased(ZMouseEvent e)
Mouse release event handler

Specified by:
mouseReleased in interface ZMouseListener

mouseEntered

public void mouseEntered(ZMouseEvent e)
Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface ZMouseListener

mouseExited

public void mouseExited(ZMouseEvent e)
Invoked when the mouse exits a component.

Specified by:
mouseExited in interface ZMouseListener

mouseClicked

public void mouseClicked(ZMouseEvent e)
Invoked when the mouse has been clicked on a component.

Specified by:
mouseClicked in interface ZMouseListener

mouseMoved

public void mouseMoved(ZMouseEvent e)
Invoked when the mouse button has been moved on a node (with no buttons no down).

Specified by:
mouseMoved in interface ZMouseMotionListener


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