edu.umd.cs.piccolox.handles
Class PHandle

java.lang.Object
  extended by edu.umd.cs.piccolo.PNode
      extended by edu.umd.cs.piccolo.nodes.PPath
          extended by edu.umd.cs.piccolox.handles.PHandle
All Implemented Interfaces:
Printable, Serializable, Cloneable
Direct Known Subclasses:
PBoundsHandle

public class PHandle
extends PPath

PHandle is used to modify some aspect of Piccolo when it is dragged. Each handle has a PLocator that it uses to automatically position itself. See PBoundsHandle for an example of a handle that resizes the bounds of another node.

Version:
1.0
Author:
Jesse Grosjean
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode
PNode.PSceneGraphDelegate
 
Field Summary
static Color DEFAULT_COLOR
          Default color to paint handles.
static Shape DEFAULT_HANDLE_SHAPE
          Default shape to use when drawing handles.
static float DEFAULT_HANDLE_SIZE
          The default size for a handle.
 
Fields inherited from class edu.umd.cs.piccolo.nodes.PPath
PROPERTY_CODE_PATH, PROPERTY_CODE_STROKE, PROPERTY_CODE_STROKE_PAINT, PROPERTY_PATH, PROPERTY_STROKE, PROPERTY_STROKE_PAINT
 
Fields inherited from class edu.umd.cs.piccolo.PNode
FILL_STRATEGY_ASPECT_COVER, FILL_STRATEGY_ASPECT_FIT, FILL_STRATEGY_EXACT_FIT, PROPERTY_BOUNDS, PROPERTY_CHILDREN, PROPERTY_CHILDREN_PICKABLE, PROPERTY_CLIENT_PROPERTIES, PROPERTY_CODE_BOUNDS, PROPERTY_CODE_CHILDREN, PROPERTY_CODE_CHILDREN_PICKABLE, PROPERTY_CODE_CLIENT_PROPERTIES, PROPERTY_CODE_FULL_BOUNDS, PROPERTY_CODE_PAINT, PROPERTY_CODE_PARENT, PROPERTY_CODE_PICKABLE, PROPERTY_CODE_TRANSFORM, PROPERTY_CODE_TRANSPARENCY, PROPERTY_CODE_VISIBLE, PROPERTY_FULL_BOUNDS, PROPERTY_PAINT, PROPERTY_PARENT, PROPERTY_PICKABLE, PROPERTY_TRANSFORM, PROPERTY_TRANSPARENCY, PROPERTY_VISIBLE, SCENE_GRAPH_DELEGATE
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
PHandle(PLocator aLocator)
          Construct a new handle that will use the given locator to locate itself on its parent node.
 
Method Summary
 void dragHandle(PDimension aLocalDimension, PInputEvent aEvent)
          Override this method to get notified as the handle is dragged.
 void endHandleDrag(Point2D aLocalPoint, PInputEvent aEvent)
          Override this method to get notified when the handle stops getting dragged.
 PDragSequenceEventHandler getHandleDraggerHandler()
          Return the event handler that is responsible for the drag handle interaction.
 PLocator getLocator()
          Get the locator that this handle uses to position itself on its parent node.
protected  void installHandleEventHandlers()
          Installs the handler that notify its subclasses of handle interaction.
 void parentBoundsChanged()
          Forces the handles to reposition themselves using their associated locator.
 void relocateHandle()
          Force this handle to relocate itself using its locator.
 void setLocator(PLocator locator)
          Set the locator that this handle uses to position itself on its parent node.
 void setParent(PNode newParent)
          Set's this handle's parent.
 void startHandleDrag(Point2D aLocalPoint, PInputEvent aEvent)
          Override this method to get notified when the handle starts to get dragged.
 
Methods inherited from class edu.umd.cs.piccolo.nodes.PPath
append, closePath, createEllipse, createLine, createPolyline, createPolyline, createRectangle, createRoundRectangle, curveTo, endResizeBounds, getPathBoundsWithStroke, getPathReference, getStroke, getStrokePaint, internalUpdateBounds, intersects, lineTo, moveTo, paint, quadTo, reset, setPathTo, setPathToEllipse, setPathToPolyline, setPathToPolyline, setPathToRectangle, setStroke, setStrokePaint, startResizeBounds, updateBoundsFromPath
 
Methods inherited from class edu.umd.cs.piccolo.PNode
addActivity, addAttribute, addChild, addChild, addChildren, addClientProperty, addInputEventListener, addPropertyChangeListener, addPropertyChangeListener, animateToBounds, animateToColor, animateToPositionScaleRotation, animateToRelativePosition, animateToTransform, animateToTransparency, animateTransformToBounds, centerBoundsOnPoint, centerFullBoundsOnPoint, clone, computeFullBounds, findIntersectingNodes, fireChildPropertyChange, firePropertyChange, fullIntersects, fullPaint, fullPick, getAllNodes, getAllNodes, getAttribute, getAttribute, getBooleanAttribute, getBounds, getBoundsChanged, getBoundsReference, getBoundsVolatile, getChild, getChildBoundsInvalid, getChildBoundsVolatile, getChildPaintInvalid, getChildrenCount, getChildrenIterator, getChildrenPickable, getChildrenReference, getClientProperties, getClientProperty, getClientPropertyKeysEnumeration, getClientPropertyKeysIterator, getDoubleAttribute, getFullBounds, getFullBoundsInvalid, getFullBoundsReference, getGlobalBounds, getGlobalFullBounds, getGlobalRotation, getGlobalScale, getGlobalToLocalTransform, getGlobalTranslation, getHeight, getInputEventListeners, getIntegerAttribute, getInverseTransform, getListenerList, getLocalToGlobalTransform, getName, getOccluded, getOffset, getPaint, getPaintInvalid, getParent, getPickable, getPropertyChangeParentMask, getRoot, getRotation, getScale, getTransform, getTransformReference, getTransparency, getUnionOfChildrenBounds, getVisible, getWidth, getX, getXOffset, getY, getYOffset, globalToLocal, globalToLocal, globalToLocal, indexOfChild, invalidateFullBounds, invalidateLayout, invalidatePaint, isAncestorOf, isDescendentOf, isDescendentOfRoot, isOpaque, layoutChildren, lerp, localToGlobal, localToGlobal, localToGlobal, localToParent, localToParent, localToParent, moveInBackOf, moveInFrontOf, moveToBack, moveToFront, offset, paintAfterChildren, paramString, parentToLocal, parentToLocal, parentToLocal, pick, pickAfterChildren, position, print, print, removeAllChildren, removeChild, removeChild, removeChildren, removeFromParent, removeInputEventListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaintFrom, reparent, replaceWith, resetBounds, rotate, rotateAboutPoint, rotateAboutPoint, rotateInPlace, scale, scaleAboutPoint, scaleAboutPoint, setBounds, setBounds, setBoundsChanged, setChildBoundsInvalid, setChildBoundsVolatile, setChildPaintInvalid, setChildrenPickable, setFullBoundsInvalid, setGlobalRotation, setGlobalScale, setGlobalTranslation, setHeight, setName, setOccluded, setOffset, setOffset, setPaint, setPaintInvalid, setPickable, setPropertyChangeParentMask, setRotation, setScale, setTransform, setTransparency, setVisible, setWidth, setX, setY, signalBoundsChanged, toImage, toImage, toImage, toImage, transformBy, translate, validateFullBounds, validateFullPaint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_HANDLE_SIZE

public static float DEFAULT_HANDLE_SIZE
The default size for a handle.


DEFAULT_HANDLE_SHAPE

public static Shape DEFAULT_HANDLE_SHAPE
Default shape to use when drawing handles.


DEFAULT_COLOR

public static Color DEFAULT_COLOR
Default color to paint handles.

Constructor Detail

PHandle

public PHandle(PLocator aLocator)
Construct a new handle that will use the given locator to locate itself on its parent node.

Parameters:
aLocator - locator to use when laying out the handle
Method Detail

installHandleEventHandlers

protected void installHandleEventHandlers()
Installs the handler that notify its subclasses of handle interaction.


getHandleDraggerHandler

public PDragSequenceEventHandler getHandleDraggerHandler()
Return the event handler that is responsible for the drag handle interaction.

Returns:
current handler for HandleDrag events

getLocator

public PLocator getLocator()
Get the locator that this handle uses to position itself on its parent node.

Returns:
the locator associated with this handle

setLocator

public void setLocator(PLocator locator)
Set the locator that this handle uses to position itself on its parent node.

Parameters:
locator - the locator to assign to this handle

startHandleDrag

public void startHandleDrag(Point2D aLocalPoint,
                            PInputEvent aEvent)
Override this method to get notified when the handle starts to get dragged.

Parameters:
aLocalPoint - point on the handle at which the event occurred
aEvent - the event responsible for starting the dragging

dragHandle

public void dragHandle(PDimension aLocalDimension,
                       PInputEvent aEvent)
Override this method to get notified as the handle is dragged.

Parameters:
aLocalDimension - size of the drag in handle coordinates
aEvent - event representing the drag

endHandleDrag

public void endHandleDrag(Point2D aLocalPoint,
                          PInputEvent aEvent)
Override this method to get notified when the handle stops getting dragged.

Parameters:
aLocalPoint - point in handle coordinate system of the end of the drag
aEvent - event responsible for ending the drag

setParent

public void setParent(PNode newParent)
Set's this handle's parent. Handles respond to changes in their parent's bounds by invalidating themselves.

Overrides:
setParent in class PNode
Parameters:
newParent - the new parent to assign to this handle

parentBoundsChanged

public void parentBoundsChanged()
Forces the handles to reposition themselves using their associated locator.

Overrides:
parentBoundsChanged in class PNode

relocateHandle

public void relocateHandle()
Force this handle to relocate itself using its locator.



Copyright © 1995-2010 Piccolo2D. All Rights Reserved.