edu.umd.cs.piccolox.pswing
Class PSwingMouseWheelEvent

java.lang.Object
  extended by java.util.EventObject
      extended by java.awt.AWTEvent
          extended by java.awt.event.ComponentEvent
              extended by java.awt.event.InputEvent
                  extended by java.awt.event.MouseEvent
                      extended by java.awt.event.MouseWheelEvent
                          extended by edu.umd.cs.piccolox.pswing.PSwingMouseWheelEvent
All Implemented Interfaces:
PSwingEvent, Serializable

public class PSwingMouseWheelEvent
extends MouseWheelEvent
implements PSwingEvent

PMouseMotionEvent is an event which indicates that a mouse motion action occurred in a node.

This low-level event is generated by a node object for:

A PMouseEvent object is passed to every PMouseMotionListener or PMouseMotionAdapter object which registered to receive mouse motion events using the component's addMouseMotionListener method. (PMouseMotionAdapter objects implement the PMouseMotionListener interface.) Each such listener object gets a PMouseEvent containing the mouse motion event.

Warning: Serialized objects of this class will not be compatible with future Piccolo releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Piccolo. A future release of Piccolo will provide support for long term persistence.

Author:
Benjamin B. Bederson, Sam R. Reid, Lance E. Good
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.event.MouseWheelEvent
WHEEL_BLOCK_SCROLL, WHEEL_UNIT_SCROLL
 
Fields inherited from class java.awt.event.MouseEvent
BUTTON1, BUTTON2, BUTTON3, MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_ENTERED, MOUSE_EXITED, MOUSE_FIRST, MOUSE_LAST, MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED, MOUSE_WHEEL, NOBUTTON
 
Fields inherited from class java.awt.event.InputEvent
ALT_DOWN_MASK, ALT_GRAPH_DOWN_MASK, ALT_GRAPH_MASK, ALT_MASK, BUTTON1_DOWN_MASK, BUTTON1_MASK, BUTTON2_DOWN_MASK, BUTTON2_MASK, BUTTON3_DOWN_MASK, BUTTON3_MASK, CTRL_DOWN_MASK, CTRL_MASK, META_DOWN_MASK, META_MASK, SHIFT_DOWN_MASK, SHIFT_MASK
 
Fields inherited from class java.awt.event.ComponentEvent
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN
 
Fields inherited from class java.awt.AWTEvent
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
protected PSwingMouseWheelEvent(int id, MouseWheelEvent swingEvent, PInputEvent piccoloEvent)
          Constructs a new PMouseWheel event from a Java MouseWheelEvent.
 
Method Summary
 MouseEvent asMouseEvent()
          Returns this event as a mouse event.
 void dispatchTo(Object listener)
          Calls appropriate method on the listener based on this events ID.
 PNode getCurrentNode()
          Get the current node that is under the cursor.
 PPickPath getCurrentPath()
          Get the path from the PCanvas down to the visual component currently under the mouse.This may give a different result then getGrabPath() durring a MOUSE_DRAGGED or MOUSE_RELEASED operation.
 PNode getGrabNode()
          Determine the node the event originated at.
 PPickPath getGrabPath()
          Return the path from the PCanvas down to the currently grabbed object.
 int getID()
          Determine the event type.
 Point2D getLocalPoint()
          Returns the x,y position of the event in the local coordinate system of the node the event occurred on.
 double getLocalX()
          Returns the horizontal x position of the event in the local coordinate system of the node the event occurred on.
 double getLocalY()
          Returns the vertical y position of the event in the local coordinate system of the node the event occurred on.
 PNode getNode()
          Determine the node the event originated at.
 PPickPath getPath()
          Determine the path the event took from the PCanvas down to the visual component.
 void setSource(Object newSource)
          Set the souce of this event.
 
Methods inherited from class java.awt.event.MouseWheelEvent
getScrollAmount, getScrollType, getUnitsToScroll, getWheelRotation, paramString
 
Methods inherited from class java.awt.event.MouseEvent
getButton, getClickCount, getLocationOnScreen, getMouseModifiersText, getPoint, getX, getXOnScreen, getY, getYOnScreen, isPopupTrigger, translatePoint
 
Methods inherited from class java.awt.event.InputEvent
consume, getModifiers, getModifiersEx, getModifiersExText, getWhen, isAltDown, isAltGraphDown, isConsumed, isControlDown, isMetaDown, isShiftDown
 
Methods inherited from class java.awt.event.ComponentEvent
getComponent
 
Methods inherited from class java.awt.AWTEvent
toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PSwingMouseWheelEvent

protected PSwingMouseWheelEvent(int id,
                                MouseWheelEvent swingEvent,
                                PInputEvent piccoloEvent)
Constructs a new PMouseWheel event from a Java MouseWheelEvent.

Parameters:
id - The event type (MOUSE_WHEEL)
swingEvent - The original swing mouse wheel event.
piccoloEvent - Piccolo2D event for use when querying about the event's piccolo2d context
Method Detail

getLocalPoint

public Point2D getLocalPoint()
Returns the x,y position of the event in the local coordinate system of the node the event occurred on.

Specified by:
getLocalPoint in interface PSwingEvent
Returns:
a Point2D object containing the x and y coordinates local to the node.

getLocalX

public double getLocalX()
Returns the horizontal x position of the event in the local coordinate system of the node the event occurred on.

Specified by:
getLocalX in interface PSwingEvent
Returns:
x a double indicating horizontal position local to the node.

getLocalY

public double getLocalY()
Returns the vertical y position of the event in the local coordinate system of the node the event occurred on.

Specified by:
getLocalY in interface PSwingEvent
Returns:
y a double indicating vertical position local to the node.

getID

public int getID()
Determine the event type.

Specified by:
getID in interface PSwingEvent
Overrides:
getID in class AWTEvent
Returns:
the id

getNode

public PNode getNode()
Determine the node the event originated at. If an event percolates up the tree and is handled by an event listener higher up in the tree than the original node that generated the event, this returns the original node. For mouse drag and release events, this is the node that the original matching press event went to - in other words, the event is 'grabbed' by the originating node.

Specified by:
getNode in interface PSwingEvent
Returns:
the node

getPath

public PPickPath getPath()
Determine the path the event took from the PCanvas down to the visual component.

Specified by:
getPath in interface PSwingEvent
Returns:
the path

getGrabNode

public PNode getGrabNode()
Determine the node the event originated at. If an event percolates up the tree and is handled by an event listener higher up in the tree than the original node that generated the event, this returns the original node. For mouse drag and release events, this is the node that the original matching press event went to - in other words, the event is 'grabbed' by the originating node.

Specified by:
getGrabNode in interface PSwingEvent
Returns:
the node

getGrabPath

public PPickPath getGrabPath()
Return the path from the PCanvas down to the currently grabbed object.

Specified by:
getGrabPath in interface PSwingEvent
Returns:
the path

getCurrentNode

public PNode getCurrentNode()
Get the current node that is under the cursor. This may return a different result then getGrabNode() when in a MOUSE_RELEASED or MOUSE_DRAGGED event.

Specified by:
getCurrentNode in interface PSwingEvent
Returns:
the current node.

getCurrentPath

public PPickPath getCurrentPath()
Get the path from the PCanvas down to the visual component currently under the mouse.This may give a different result then getGrabPath() durring a MOUSE_DRAGGED or MOUSE_RELEASED operation.

Specified by:
getCurrentPath in interface PSwingEvent
Returns:
the current path.

dispatchTo

public void dispatchTo(Object listener)
Calls appropriate method on the listener based on this events ID.

Specified by:
dispatchTo in interface PSwingEvent
Parameters:
listener - the target for dispatch.

setSource

public void setSource(Object newSource)
Set the souce of this event. As the event is fired up the tree the source of the event will keep changing to reflect the scenegraph object that is firing the event.

Specified by:
setSource in interface PSwingEvent
Overrides:
setSource in class AWTEvent
Parameters:
newSource - the current source of the event to report

asMouseEvent

public MouseEvent asMouseEvent()
Returns this event as a mouse event. This reduces the need to cast instances of this interface when they are known to all extend MouseEvent.

Specified by:
asMouseEvent in interface PSwingEvent
Returns:
this object casted to a MouseEvent


Copyright © 1995-2010 Piccolo2D. All Rights Reserved.