http://www.jpicedt.org

jpicedt.graphic.toolkit
Class SelectionTool

java.lang.Object
  extended by java.awt.event.KeyAdapter
      extended by jpicedt.graphic.toolkit.MouseTool
          extended by jpicedt.graphic.toolkit.SelectionTool
All Implemented Interfaces:
KeyListener, EventListener, PEMouseInputListener
Direct Known Subclasses:
ConvexZoneSelectionTool, ElementSelectionTool

public abstract class SelectionTool
extends MouseTool

This generic mouse-tool is dedicated to applying MouseTransform's to elements of a Drawing, following a uniform sequence of mouse-events. This class works hand-in-hand with a pluggable MouseTransformFactory which produces MouseTransform's on the fly from incoming mouse-events. Then any ensuing mouse-event invokes a specific method from the produced MouseTransform.

Basically, the sequence of mouse-events comprises:

Besides, this tool opens a context-sensitive popup menu when a right-click occurs, by delegating to the hosting EditorKit to obtain a suitable PopupMenuFactory. It also sets the cursor shape according to the currently installed MouseTransform.

[SR:pending] refactor class name to sth like "GenericTool" or "MouseTransformTool"…

Since:
jPicEdt 1.3.2
Version:
$Id: SelectionTool.java,v 1.24 2013/03/27 06:56:21 vincentb1 Exp $

Author:
Sylvain Reynal

Nested Class Summary
 
Nested classes/interfaces inherited from class jpicedt.graphic.toolkit.MouseTool
MouseTool.MouseToolType
 
Field Summary
protected  CursorFactory cursorFactory
           
protected  EditorKit editorKit
           
protected  MouseTransformFactory mtFactory
           
protected  UserConfirmationCache ucc
           
 
Fields inherited from class jpicedt.graphic.toolkit.MouseTool
lastMouseEvent, mouseOutside
 
Constructor Summary
protected SelectionTool(EditorKit editorKit, MouseTransformFactory mtFactory)
           
 
Method Summary
 void flush()
          Appelé lorsque cet outil est remplacé par un autre outil à la souris dans l'EditorKit hôte ; La fonction est en grande partie déléguée à la MouseTransform sousjacente.
 void init()
          Appelé lorsque cet outil est activé par l'EditorKit hôte ; La fonction est en grande partie déléguée à la MouseTransform sousjacente.
 void mouseDragged(PEMouseEvent e)
          Invoke "process" on the current MouseTransform (if non-null).
 void mouseMoved(PEMouseEvent e)
          Invoke "process" on the current MouseTransform (if non-null).
 void mousePressed(PEMouseEvent e)
           clic droit souris (déclencheur de menu contextuel) → déroule le menu contextuel.
 void mouseReleased(PEMouseEvent e)
          Invokes "next()" on the current MouseTransform if non-null.
 void paint(Graphics2D g, Rectangle2D allocation, double scale)
          Do tool specific painting.
 
Methods inherited from class jpicedt.graphic.toolkit.MouseTool
getLastMouseEvent, keyPressed, keyReleased, mouseClicked, mouseEntered, mouseExited, processKeyEvent
 
Methods inherited from class java.awt.event.KeyAdapter
keyTyped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

editorKit

protected EditorKit editorKit

cursorFactory

protected CursorFactory cursorFactory

mtFactory

protected MouseTransformFactory mtFactory

ucc

protected UserConfirmationCache ucc
Constructor Detail

SelectionTool

protected SelectionTool(EditorKit editorKit,
                        MouseTransformFactory mtFactory)
Parameters:
editorKit - the editorKit that owns this mouseTool
mtFactory - the factory that produces MouseTransform's in response to a mousePressed
Method Detail

paint

public void paint(Graphics2D g,
                  Rectangle2D allocation,
                  double scale)
Do tool specific painting. Merely delegates to the currently active mouse transform, as well as to the installed MouseTransformFactory.

Overrides:
paint in class MouseTool

init

public void init()
Appelé lorsque cet outil est activé par l'EditorKit hôte ; La fonction est en grande partie déléguée à la MouseTransform sousjacente.

Overrides:
init in class MouseTool

flush

public void flush()
Appelé lorsque cet outil est remplacé par un autre outil à la souris dans l'EditorKit hôte ; La fonction est en grande partie déléguée à la MouseTransform sousjacente.

Overrides:
flush in class MouseTool

mousePressed

public void mousePressed(PEMouseEvent e)

Specified by:
mousePressed in interface PEMouseInputListener
Overrides:
mousePressed in class MouseTool

mouseDragged

public void mouseDragged(PEMouseEvent e)
Invoke "process" on the current MouseTransform (if non-null).

Specified by:
mouseDragged in interface PEMouseInputListener
Overrides:
mouseDragged in class MouseTool

mouseReleased

public void mouseReleased(PEMouseEvent e)
Invokes "next()" on the current MouseTransform if non-null.

Specified by:
mouseReleased in interface PEMouseInputListener
Overrides:
mouseReleased in class MouseTool

mouseMoved

public void mouseMoved(PEMouseEvent e)
Invoke "process" on the current MouseTransform (if non-null). Otherwise change mouse cursor according to the MouseTransform returned by the factory for the given PEMouseEvent.

Specified by:
mouseMoved in interface PEMouseInputListener
Overrides:
mouseMoved in class MouseTool

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org