templates.presentation
Class MouseInterpreter

java.lang.Object
  extended by templates.presentation.MouseInterpreter
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener

public class MouseInterpreter
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Processes the mouse actions of the user when manipulating a TemplateEditableCanvas. This is a non-exhaustive list of supported mouse actions:

Author:
Lenko Grigorov
See Also:
TemplateEditableCanvas

Field Summary
protected  TemplateEditableCanvas canvas
          The canvas with which the user interacts.
protected  Entity connectorOrigin
          The entity where the new connector originates when the user starts drawing a new connector.
protected  TemplateDiagram diagram
          The template diagram in displayed in the canvas.
protected  boolean draggedSelection
          Information about whether the dragging operation was performed to drag the current selection.
protected  java.awt.Point lastDragLocation
          The last recorded location of the mouse cursor while the user was dragging.
protected  java.awt.Point mouseDownAt
          The location of the mouse cursor when the mouse button was depressed last.
protected  DiagramElement mouseDownOn
          The diagram element under the mouse cursor when the mouse button was depressed last.
 
Constructor Summary
MouseInterpreter(TemplateEditableCanvas canvas)
          Construct a new mouse interpreter for the given canvas.
 
Method Summary
protected  void cancelConnector()
          Cancel the drawing of a new connector (e.g., when the user does not finish drawing the connector before engaging in a different activity).
 void mouseClicked(java.awt.event.MouseEvent arg0)
           
 void mouseDragged(java.awt.event.MouseEvent arg0)
           
 void mouseEntered(java.awt.event.MouseEvent arg0)
          Do nothing.
 void mouseExited(java.awt.event.MouseEvent arg0)
          Do nothing.
 void mouseMoved(java.awt.event.MouseEvent arg0)
           
 void mousePopupTrigger(java.awt.event.MouseEvent arg0)
          Show the context (right-click) pop-up menu for the diagram element under the mouse cursor.
 void mousePressed(java.awt.event.MouseEvent arg0)
           
 void mouseReleased(java.awt.event.MouseEvent arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canvas

protected TemplateEditableCanvas canvas
The canvas with which the user interacts.


diagram

protected TemplateDiagram diagram
The template diagram in displayed in the canvas.


mouseDownAt

protected java.awt.Point mouseDownAt
The location of the mouse cursor when the mouse button was depressed last.


mouseDownOn

protected DiagramElement mouseDownOn
The diagram element under the mouse cursor when the mouse button was depressed last. Set to null in case there is no such element.


lastDragLocation

protected java.awt.Point lastDragLocation
The last recorded location of the mouse cursor while the user was dragging.


draggedSelection

protected boolean draggedSelection
Information about whether the dragging operation was performed to drag the current selection. Set to true if the user dragged the current selection, set to false otherwise.


connectorOrigin

protected Entity connectorOrigin
The entity where the new connector originates when the user starts drawing a new connector.

Constructor Detail

MouseInterpreter

public MouseInterpreter(TemplateEditableCanvas canvas)
Construct a new mouse interpreter for the given canvas.

Parameters:
canvas - the canvas for with which the user will interact
Method Detail

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent arg0)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePopupTrigger

public void mousePopupTrigger(java.awt.event.MouseEvent arg0)
Show the context (right-click) pop-up menu for the diagram element under the mouse cursor.

Parameters:
arg0 - the description of the mouse event

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent arg0)
Do nothing.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent arg0)
Do nothing.

Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent arg0)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent arg0)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

cancelConnector

protected void cancelConnector()
Cancel the drawing of a new connector (e.g., when the user does not finish drawing the connector before engaging in a different activity).


mouseDragged

public void mouseDragged(java.awt.event.MouseEvent arg0)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent arg0)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener