edu.umd.cs.piccolo.event
Class PDragSequenceEventHandler

java.lang.Object
  extended by edu.umd.cs.piccolo.event.PBasicInputEventHandler
      extended by edu.umd.cs.piccolo.event.PDragSequenceEventHandler
All Implemented Interfaces:
PInputEventListener, java.util.EventListener
Direct Known Subclasses:
PDragEventHandler, PPanEventHandler, PSelectionEventHandler, PZoomEventHandler

public abstract class PDragSequenceEventHandler
extends PBasicInputEventHandler

PDragSequenceEventHandler is designed to support mouse pressed, dragged, and released interaction sequences. Support is also provided for running a continuous activity during the drag sequence.

PDragSequenceEventHandler should be subclassed by a concrete event handler that implements a particular interaction. See PPanEventHandler, PZoomEventHandler, and PDragEventHandler for examples.

Version:
1.0
Author:
Jesse Grosjean

Constructor Summary
PDragSequenceEventHandler()
           
 
Method Summary
protected  void drag(PInputEvent e)
          Subclasses should override this method to get notified of the drag events in a drag sequence.
protected  void dragActivityFinalStep(PInputEvent aEvent)
          Override this method to get notified when the drag activity stops stepping.
protected  void dragActivityFirstStep(PInputEvent aEvent)
          Override this method to get notified when the drag activity starts stepping.
protected  void dragActivityStep(PInputEvent aEvent)
          During a drag sequence an activity is scheduled that runs continuously while the drag sequence is active.
protected  void endDrag(PInputEvent e)
          Subclasses should override this method to get notified of the end event in a drag sequence.
protected  PActivity getDragActivity()
           
 double getMinDragStartDistance()
           
 java.awt.geom.Point2D getMousePressedCanvasPoint()
          Return the point in canvas coordinates where the mouse was last pressed.
 boolean isDragging()
           
 void mouseDragged(PInputEvent e)
           
 void mousePressed(PInputEvent e)
           
 void mouseReleased(PInputEvent e)
           
protected  java.lang.String paramString()
          Returns a string representing the state of this node.
 void setIsDragging(boolean isDragging)
           
 void setMinDragStartDistance(double minDistance)
          Set the minimum distance that the mouse should be dragged (in screen coords) before a new drag sequence is initiate.
protected  boolean shouldStartDragInteraction(PInputEvent e)
           
protected  void startDrag(PInputEvent e)
          Subclasses should override this method to get notified of the start of a new drag sequence.
protected  void startDragActivity(PInputEvent aEvent)
           
protected  void stopDragActivity(PInputEvent aEvent)
           
 
Methods inherited from class edu.umd.cs.piccolo.event.PBasicInputEventHandler
acceptsEvent, getEventFilter, keyboardFocusGained, keyboardFocusLost, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, mouseWheelRotated, mouseWheelRotatedByBlock, processEvent, setEventFilter, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDragSequenceEventHandler

public PDragSequenceEventHandler()
Method Detail

isDragging

public boolean isDragging()

setIsDragging

public void setIsDragging(boolean isDragging)

getMinDragStartDistance

public double getMinDragStartDistance()

setMinDragStartDistance

public void setMinDragStartDistance(double minDistance)
Set the minimum distance that the mouse should be dragged (in screen coords) before a new drag sequence is initiate.


getMousePressedCanvasPoint

public java.awt.geom.Point2D getMousePressedCanvasPoint()
Return the point in canvas coordinates where the mouse was last pressed.


startDrag

protected void startDrag(PInputEvent e)
Subclasses should override this method to get notified of the start of a new drag sequence. Note that that overriding methods must still call super.startDrag() for correct behavior.


drag

protected void drag(PInputEvent e)
Subclasses should override this method to get notified of the drag events in a drag sequence. Note that that overriding methods must still call super.startDrag() for correct behavior.


endDrag

protected void endDrag(PInputEvent e)
Subclasses should override this method to get notified of the end event in a drag sequence. Note that that overriding methods must still call super.startDrag() for correct behavior.


shouldStartDragInteraction

protected boolean shouldStartDragInteraction(PInputEvent e)

getDragActivity

protected PActivity getDragActivity()

startDragActivity

protected void startDragActivity(PInputEvent aEvent)

stopDragActivity

protected void stopDragActivity(PInputEvent aEvent)

dragActivityFirstStep

protected void dragActivityFirstStep(PInputEvent aEvent)
Override this method to get notified when the drag activity starts stepping.


dragActivityStep

protected void dragActivityStep(PInputEvent aEvent)
During a drag sequence an activity is scheduled that runs continuously while the drag sequence is active. This can be used to support some additional behavior that is not driven directly by mouse events. For example PZoomEventHandler uses it for zooming and PPanEventHandler uses it for auto panning.


dragActivityFinalStep

protected void dragActivityFinalStep(PInputEvent aEvent)
Override this method to get notified when the drag activity stops stepping.


mousePressed

public void mousePressed(PInputEvent e)
Overrides:
mousePressed in class PBasicInputEventHandler

mouseDragged

public void mouseDragged(PInputEvent e)
Overrides:
mouseDragged in class PBasicInputEventHandler

mouseReleased

public void mouseReleased(PInputEvent e)
Overrides:
mouseReleased in class PBasicInputEventHandler

paramString

protected java.lang.String paramString()
Returns a string representing the state of this node. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
paramString in class PBasicInputEventHandler
Returns:
a string representation of this node's state


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