http://www.jpicedt.org

jpicedt.graphic.toolkit
Class DrawToolFactory.AbstractCurveDrawTool

java.lang.Object
  extended by java.awt.event.KeyAdapter
      extended by jpicedt.graphic.toolkit.MouseTool
          extended by jpicedt.graphic.toolkit.DrawToolFactory.AbstractCurveDrawTool
All Implemented Interfaces:
KeyListener, EventListener, PEMouseInputListener
Enclosing class:
DrawToolFactory

protected class DrawToolFactory.AbstractCurveDrawTool
extends MouseTool

a MouseTool suited for drawing any element inheriting from AbstractCurve. Because of slight differences that appear in the drawing sequence, this class currently specializes on PicMultiCurve, PicPsCurve and PicSmoothPolygon. This should be improved in the near future by providing a common interface [SR:pending].

The drawing sequence is as follows:

author: Vincent Guirardel, Sylvain Reynal


Nested Class Summary
 
Nested classes/interfaces inherited from class jpicedt.graphic.toolkit.MouseTool
MouseTool.MouseToolType
 
Field Summary
 
Fields inherited from class jpicedt.graphic.toolkit.MouseTool
lastMouseEvent, mouseOutside
 
Constructor Summary
DrawToolFactory.AbstractCurveDrawTool(AbstractCurve prototype)
           
 
Method Summary
 void flush()
          called when this tool is being replaced by another mouse-tool in the hosting editor kit ; this is mainly for mousetools using more than one sequence, for it gives them a chance to clean themselves up for the next time
 void init()
          called when this tool is being activated in the hosting editor kit
 void mouseDragged(PEMouseEvent e)
          set the current point
 void mouseMoved(PEMouseEvent e)
          set cursor for canvas, then call mouseDragged
 void mousePressed(PEMouseEvent e)
          A popup-trigger mouse event (e.g. a right click on Unix/Windows): switches back to SELECT_MODE if the iterator is completed or terminates the drawing process.
 void mouseReleased(PEMouseEvent e)
          CLOSED curve only : add a new point by splitting last segment
 void paint(Graphics2D g, Rectangle2D allocation, double scale)
          This method is called by the hosting EditorKit : this implementation paints the current element's highlighter.
 
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
 

Constructor Detail

DrawToolFactory.AbstractCurveDrawTool

public DrawToolFactory.AbstractCurveDrawTool(AbstractCurve prototype)
Parameters:
prototype - Prototype which will be cloned, then added to the drawing.
Method Detail

mousePressed

public void mousePressed(PEMouseEvent e)
A popup-trigger mouse event (e.g. a right click on Unix/Windows): A left-button SINGLE click either:

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

mouseReleased

public void mouseReleased(PEMouseEvent e)
CLOSED curve only : add a new point by splitting last segment

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

mouseDragged

public void mouseDragged(PEMouseEvent e)
set the current point

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

mouseMoved

public void mouseMoved(PEMouseEvent e)
set cursor for canvas, then call mouseDragged

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

init

public void init()
called when this tool is being activated in the hosting editor kit

Overrides:
init in class MouseTool

flush

public void flush()
called when this tool is being replaced by another mouse-tool in the hosting editor kit ; this is mainly for mousetools using more than one sequence, for it gives them a chance to clean themselves up for the next time

Overrides:
flush in class MouseTool

paint

public void paint(Graphics2D g,
                  Rectangle2D allocation,
                  double scale)
This method is called by the hosting EditorKit : this implementation paints the current element's highlighter.

Overrides:
paint in class MouseTool

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org