org.openbp.cockpit.modeler.tools
Class ModelerToolSupport

java.lang.Object
  extended by CH.ifa.draw.standard.AbstractTool
      extended by org.openbp.cockpit.modeler.tools.ModelerToolSupport
All Implemented Interfaces:
CH.ifa.draw.framework.Tool, CH.ifa.draw.framework.ViewChangeListener, java.util.EventListener

public class ModelerToolSupport
extends CH.ifa.draw.standard.AbstractTool

The node manipulation tool is the standard tool used by the modeler. It handles regular object selection as well as rubber band tracking, double click on objects and figure popup menu invocations. It also supports moving the workspace view while the ALT key is pressed (track).

Author:
Stephan Pauxberger

Nested Class Summary
 
Nested classes/interfaces inherited from class CH.ifa.draw.standard.AbstractTool
CH.ifa.draw.standard.AbstractTool.EventDispatcher
 
Field Summary
 
Fields inherited from class CH.ifa.draw.standard.AbstractTool
fAnchorX, fAnchorY
 
Constructor Summary
ModelerToolSupport(DrawingEditorPlugin editor)
          Constructs the tool for the given editor.
 
Method Summary
 void activateTool(ModelerTool tool, java.lang.Object objectUnderCursor)
          Activates the given tool.
 void addToolDecisionTableEntry(ModelerTool tool, java.lang.Class figureClass, int requiredInputState)
          Adds an entry to the tool decision table.
protected  void clearTool()
          Clears the current tool.
 void deactivate()
           
protected  ModelerToolDecisionTableEntry determineTool(java.lang.Object object)
          Gets the tool that would be applied to the given object according to the current settings and input states.
 void displayInPlaceEditor(ProcessElementContainer figure)
          Shows the in place editor for the given figure.
 DrawingEditorPlugin getEditor()
          Gets the editor that owns the tool.
 VisualElement getLastFigure()
          Gets the last figure that has been hovered with the mouse.
 java.awt.Point getLastPoint()
          Returns the last known mouse coordinates.
 WorkspaceDrawingView getView()
          Gets the view we refer to.
 void keyDown(java.awt.event.KeyEvent e, int key)
           
 void keyUp(java.awt.event.KeyEvent e, int key)
           
 void mouseDown(java.awt.event.MouseEvent e, int x, int y)
           
 void mouseDrag(java.awt.event.MouseEvent e, int x, int y)
           
 void mouseMove(java.awt.event.MouseEvent e, int x, int y)
           
 void mouseUp(java.awt.event.MouseEvent e, int x, int y)
           
 void toggleInPlaceEditor(ProcessElementContainer figure, boolean delay)
          Shows or hides the in place editor for the given figure.
 void updateToolState()
           
protected  void updateToolState(java.awt.event.KeyEvent e)
          Updates the cursor in case of a key press.
 
Methods inherited from class CH.ifa.draw.standard.AbstractTool
activate, addToolListener, checkUsable, createEventDispatcher, drawing, editor, getEventDispatcher, getUndoActivity, isActive, isEnabled, isUsable, removeToolListener, setEnabled, setUndoActivity, setUsable, view, viewCreated, viewDestroying, viewSelectionChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelerToolSupport

public ModelerToolSupport(DrawingEditorPlugin editor)
Constructs the tool for the given editor.

Parameters:
editor - Editor that owns the tool
Method Detail

addToolDecisionTableEntry

public void addToolDecisionTableEntry(ModelerTool tool,
                                      java.lang.Class figureClass,
                                      int requiredInputState)
Adds an entry to the tool decision table.

Parameters:
tool - Tool
figureClass - Class of the figure this tool is suitable for or null for any
requiredInputState - Expected keyboard and mouse button input state or 0 for any

deactivate

public void deactivate()
Specified by:
deactivate in interface CH.ifa.draw.framework.Tool
Overrides:
deactivate in class CH.ifa.draw.standard.AbstractTool

activateTool

public void activateTool(ModelerTool tool,
                         java.lang.Object objectUnderCursor)
Activates the given tool.

Parameters:
tool - Tool to activate
objectUnderCursor - Object that will be affected by the tool

clearTool

protected void clearTool()
Clears the current tool.


getLastPoint

public java.awt.Point getLastPoint()
Returns the last known mouse coordinates. Used for break out box display.


getLastFigure

public VisualElement getLastFigure()
Gets the last figure that has been hovered with the mouse.


getEditor

public DrawingEditorPlugin getEditor()
Gets the editor that owns the tool.


getView

public WorkspaceDrawingView getView()
Gets the view we refer to.


mouseMove

public void mouseMove(java.awt.event.MouseEvent e,
                      int x,
                      int y)
Specified by:
mouseMove in interface CH.ifa.draw.framework.Tool
Overrides:
mouseMove in class CH.ifa.draw.standard.AbstractTool

mouseDown

public void mouseDown(java.awt.event.MouseEvent e,
                      int x,
                      int y)
Specified by:
mouseDown in interface CH.ifa.draw.framework.Tool
Overrides:
mouseDown in class CH.ifa.draw.standard.AbstractTool

mouseUp

public void mouseUp(java.awt.event.MouseEvent e,
                    int x,
                    int y)
Specified by:
mouseUp in interface CH.ifa.draw.framework.Tool
Overrides:
mouseUp in class CH.ifa.draw.standard.AbstractTool

mouseDrag

public void mouseDrag(java.awt.event.MouseEvent e,
                      int x,
                      int y)
Specified by:
mouseDrag in interface CH.ifa.draw.framework.Tool
Overrides:
mouseDrag in class CH.ifa.draw.standard.AbstractTool

keyDown

public void keyDown(java.awt.event.KeyEvent e,
                    int key)
Specified by:
keyDown in interface CH.ifa.draw.framework.Tool
Overrides:
keyDown in class CH.ifa.draw.standard.AbstractTool

keyUp

public void keyUp(java.awt.event.KeyEvent e,
                  int key)

displayInPlaceEditor

public void displayInPlaceEditor(ProcessElementContainer figure)
Shows the in place editor for the given figure.

Parameters:
figure - Process element container figure to edit

toggleInPlaceEditor

public void toggleInPlaceEditor(ProcessElementContainer figure,
                                boolean delay)
Shows or hides the in place editor for the given figure.

Parameters:
figure - Process element container figure to edit

updateToolState

public void updateToolState()

updateToolState

protected void updateToolState(java.awt.event.KeyEvent e)
Updates the cursor in case of a key press.

Parameters:
e - Key event

determineTool

protected ModelerToolDecisionTableEntry determineTool(java.lang.Object object)
Gets the tool that would be applied to the given object according to the current settings and input states.

Parameters:
object - Object under cursor
Returns:
The tool entry or null


Copyright © 2011. All Rights Reserved.