JHotDraw 7.4.1

org.jhotdraw.draw.tool
Class BezierTool

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.draw.tool.AbstractTool
          extended by org.jhotdraw.draw.tool.BezierTool
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Tool
Direct Known Subclasses:
PathTool, PathTool

public class BezierTool
extends AbstractTool

A Tool which allows to create a new BezierFigure by drawing its path.

Version:
$Id: BezierTool.java 604 2010-01-09 12:00:29Z rawcoder $
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
protected  java.util.Map<AttributeKey,java.lang.Object> attributes
           
protected  BezierFigure createdFigure
          The created figure.
 
Fields inherited from class org.jhotdraw.draw.tool.AbstractTool
anchor, editor, isWorking, listenerList
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Constructor Summary
BezierTool(BezierFigure prototype)
          Creates a new instance.
BezierTool(BezierFigure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes)
          Creates a new instance.
BezierTool(BezierFigure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes, java.lang.String name)
           
 
Method Summary
 void activate(DrawingEditor editor)
          Activates the tool for the given editor.
protected  void addPointToFigure(java.awt.geom.Point2D.Double newPoint)
           
protected  BezierPath calculateFittedCurve(BezierPath path)
           
protected  BezierFigure createFigure()
           
 void deactivate(DrawingEditor editor)
          Deactivates the tool.
 void draw(java.awt.Graphics2D g)
          Draws the tool.
protected  void finishCreation(BezierFigure createdFigure, DrawingView creationView)
           
protected  void fireUndoEvent(Figure createdFigure, DrawingView creationView)
           
protected  Figure getAddedFigure()
           
protected  Figure getCreatedFigure()
           
 java.lang.String getPresentationName()
           
 boolean isToolDoneAfterCreation()
           
 void mouseClicked(java.awt.event.MouseEvent evt)
           
 void mouseDragged(java.awt.event.MouseEvent evt)
           
 void mouseMoved(java.awt.event.MouseEvent evt)
           
 void mousePressed(java.awt.event.MouseEvent evt)
           
 void mouseReleased(java.awt.event.MouseEvent evt)
           
 void setToolDoneAfterCreation(boolean b)
           
 
Methods inherited from class org.jhotdraw.draw.tool.AbstractTool
addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, createActionMap, createInputMap, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireBoundsInvalidated, fireToolDone, fireToolStarted, getActionMap, getDrawing, getEditor, getInputMap, getToolTipText, getView, isActive, keyPressed, keyReleased, keyTyped, maybeFireBoundsInvalidated, mouseEntered, mouseExited, removeToolListener, removeUndoableEditListener, setActionMap, setInputMap, supportsHandleInteraction, updateCursor, viewToDrawing
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributes

protected java.util.Map<AttributeKey,java.lang.Object> attributes

createdFigure

protected BezierFigure createdFigure
The created figure.

Constructor Detail

BezierTool

public BezierTool(BezierFigure prototype)
Creates a new instance.


BezierTool

public BezierTool(BezierFigure prototype,
                  java.util.Map<AttributeKey,java.lang.Object> attributes)
Creates a new instance.


BezierTool

public BezierTool(BezierFigure prototype,
                  java.util.Map<AttributeKey,java.lang.Object> attributes,
                  java.lang.String name)
Method Detail

getPresentationName

public java.lang.String getPresentationName()

activate

public void activate(DrawingEditor editor)
Description copied from interface: Tool
Activates the tool for the given editor. This method is called whenever the user switches to this tool.

Specified by:
activate in interface Tool
Overrides:
activate in class AbstractTool

deactivate

public void deactivate(DrawingEditor editor)
Description copied from interface: Tool
Deactivates the tool. This method is called whenever the user switches to another tool.

Specified by:
deactivate in interface Tool
Overrides:
deactivate in class AbstractTool

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class AbstractTool

createFigure

protected BezierFigure createFigure()

getCreatedFigure

protected Figure getCreatedFigure()

getAddedFigure

protected Figure getAddedFigure()

addPointToFigure

protected void addPointToFigure(java.awt.geom.Point2D.Double newPoint)

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent evt)
Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class AbstractTool

fireUndoEvent

protected void fireUndoEvent(Figure createdFigure,
                             DrawingView creationView)

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class AbstractTool

finishCreation

protected void finishCreation(BezierFigure createdFigure,
                              DrawingView creationView)

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)

draw

public void draw(java.awt.Graphics2D g)
Description copied from interface: Tool
Draws the tool.

Specified by:
draw in interface Tool
Overrides:
draw in class AbstractTool

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent evt)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class AbstractTool

calculateFittedCurve

protected BezierPath calculateFittedCurve(BezierPath path)

setToolDoneAfterCreation

public void setToolDoneAfterCreation(boolean b)

isToolDoneAfterCreation

public boolean isToolDoneAfterCreation()

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.