y25.view
Class ViewMode25D

java.lang.Object
  extended byy25.view.ViewMode25D
All Implemented Interfaces:
EventListener, MouseInputListener, MouseListener, MouseMotionListener, MouseWheelListener
Direct Known Subclasses:
NavigationMode25D

public class ViewMode25D
extends Object
implements MouseInputListener, MouseWheelListener

Handles mouse events coming from a Graph25DView.

A view mode has to be bound to a Graph25DView by calling setActiveView before it receives any mouse input events. When a view mode is added to a Graph25DView via a call to Graph25DView#addViewMode25D, this happens automatically.

As a convenience, this class stores the mouse position of an event relative to the mouse position of the last event inside deltaDrag, which can be read inside the event handling methods.

When deriving from this class, make sure that all overriden methods you implement first call the respective super method first.


Field Summary
protected  Point deltaDrag
          The mouse position relative to the last drag event.
protected  MouseEvent lastClickEvent
          The last mouse click event.
protected  MouseEvent lastDragEvent
          The last mouse drag event.
protected  MouseEvent lastPressEvent
          The last mouse press event.
protected  MouseEvent lastReleaseEvent
          The last mouse release event.
protected  Graph25DView view
          The view this mode gets mouse events from.
 
Constructor Summary
ViewMode25D()
           
 
Method Summary
protected  Point delta(MouseEvent from, MouseEvent to)
          Returns the difference vector from from to to.
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseDraggedLeft(MouseEvent e)
           
 void mouseDraggedMiddle(MouseEvent e)
           
 void mouseDraggedRight(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void mouseShiftDraggedLeft(MouseEvent e)
           
 void mouseShiftDraggedMiddle(MouseEvent e)
           
 void mouseShiftDraggedRight(MouseEvent e)
           
 void mouseWheelMoved(MouseWheelEvent e)
           
 void setActiveView(Graph25DView v)
          Sets the view this mode receives mouse events from.
protected  boolean shiftPressed(MouseEvent e)
          Determines if the SHIFT modifier key has been pressed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

view

protected Graph25DView view
The view this mode gets mouse events from.


lastClickEvent

protected MouseEvent lastClickEvent
The last mouse click event.


lastPressEvent

protected MouseEvent lastPressEvent
The last mouse press event.


lastReleaseEvent

protected MouseEvent lastReleaseEvent
The last mouse release event.


lastDragEvent

protected MouseEvent lastDragEvent
The last mouse drag event.


deltaDrag

protected Point deltaDrag
The mouse position relative to the last drag event.

Constructor Detail

ViewMode25D

public ViewMode25D()
Method Detail

delta

protected Point delta(MouseEvent from,
                      MouseEvent to)
Returns the difference vector from from to to.


setActiveView

public void setActiveView(Graph25DView v)
Sets the view this mode receives mouse events from. This method has to be called before any events are passed to this view mode.


mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener

mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface MouseWheelListener

mouseDraggedLeft

public void mouseDraggedLeft(MouseEvent e)

mouseDraggedMiddle

public void mouseDraggedMiddle(MouseEvent e)

mouseDraggedRight

public void mouseDraggedRight(MouseEvent e)

mouseShiftDraggedLeft

public void mouseShiftDraggedLeft(MouseEvent e)

mouseShiftDraggedMiddle

public void mouseShiftDraggedMiddle(MouseEvent e)

mouseShiftDraggedRight

public void mouseShiftDraggedRight(MouseEvent e)

shiftPressed

protected boolean shiftPressed(MouseEvent e)
Determines if the SHIFT modifier key has been pressed.