JHotDraw 7.0.6

org.jhotdraw.draw
Class CreationTool

java.lang.Object
  extended by org.jhotdraw.draw.AbstractTool
      extended by org.jhotdraw.draw.CreationTool
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, Tool
Direct Known Subclasses:
TextAreaTool, TextTool

public class CreationTool
extends AbstractTool

A tool to create new figures. The figure to be created is specified by a prototype.


Field Summary
protected  Figure createdFigure
          The created figure.
protected  CompositeEdit creationEdit
           
 
Fields inherited from class org.jhotdraw.draw.AbstractTool
anchor, editor, isWorking, listenerList
 
Constructor Summary
CreationTool(Figure prototype)
           
CreationTool(Figure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes)
          Creates a new instance.
CreationTool(Figure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes, java.lang.String name)
          Creates a new instance.
CreationTool(java.lang.String prototypeClassName)
          Creates a new instance.
CreationTool(java.lang.String prototypeClassName, java.util.Map<AttributeKey,java.lang.Object> attributes)
           
CreationTool(java.lang.String prototypeClassName, java.util.Map<AttributeKey,java.lang.Object> attributes, java.lang.String name)
           
 
Method Summary
 void activate(DrawingEditor editor)
          Activates the tool for the given view.
protected  Figure createFigure()
           
 void deactivate(DrawingEditor editor)
          Deactivates the tool.
protected  Figure getAddedFigure()
           
protected  Figure getCreatedFigure()
           
 Figure getPrototype()
           
 void mouseDragged(java.awt.event.MouseEvent evt)
           
 void mousePressed(java.awt.event.MouseEvent evt)
           
 void mouseReleased(java.awt.event.MouseEvent evt)
           
 
Methods inherited from class org.jhotdraw.draw.AbstractTool
addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, draw, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireToolDone, fireToolStarted, getDrawing, getEditor, getView, isActive, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, removeToolListener, removeUndoableEditListener, updateCursor, viewToDrawing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

createdFigure

protected Figure createdFigure
The created figure.


creationEdit

protected CompositeEdit creationEdit
Constructor Detail

CreationTool

public CreationTool(java.lang.String prototypeClassName)
Creates a new instance.


CreationTool

public CreationTool(java.lang.String prototypeClassName,
                    java.util.Map<AttributeKey,java.lang.Object> attributes)

CreationTool

public CreationTool(java.lang.String prototypeClassName,
                    java.util.Map<AttributeKey,java.lang.Object> attributes,
                    java.lang.String name)

CreationTool

public CreationTool(Figure prototype)

CreationTool

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


CreationTool

public CreationTool(Figure prototype,
                    java.util.Map<AttributeKey,java.lang.Object> attributes,
                    java.lang.String name)
Creates a new instance.

Method Detail

getPrototype

public Figure getPrototype()

activate

public void activate(DrawingEditor editor)
Description copied from interface: Tool
Activates the tool for the given view. This method is called whenever the user switches to this tool. Use this method to reinitialize a tool. Note, a valid view must be present in order for the tool to accept activation

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. Use this method to do some clean-up when the tool is switched. Subclassers should always call super.deactivate.

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 Figure createFigure()

getCreatedFigure

protected Figure getCreatedFigure()

getAddedFigure

protected Figure getAddedFigure()

mouseDragged

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

mouseReleased

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

Copyright 1996-2006 © JHotDraw.org