org.micropainter.core.tool
Class AbstractTool

java.lang.Object
  extended by org.micropainter.core.tool.AbstractTool
Direct Known Subclasses:
AreaTool, BezierTool, CrossMarkerTool, InterpolatorTool, MerCarrierPointerTool, MiniDeviceTool, PeakHolderTool, Potar, ShapeTool, TranslateTool, WindowTool, ZoomBoxTool, ZoomObjectifTool, ZoomPercentTool, ZoomTool, ZoomWheelTool

public abstract class AbstractTool
extends java.lang.Object

define an abstract tool and fundamentals controls

Author:
Sebastien janaud

Nested Class Summary
 class AbstractTool.KeyboardAction
          Keyboard action mapping
 
Field Summary
private  Antialiasing antialiasing
          aliasing
private  java.util.Vector<ToolControl> controls
          tool controls
private  Fractional fractional
          fractional
private  Interpolation interpolation
          interpolation
private  java.util.Vector<AbstractTool.KeyboardAction> keyboardActions
          keyboard actions
private  javax.swing.event.EventListenerList listenerList
          listeners
private  boolean lockSelected
          lock selected
private  java.lang.String name
          the tool name
private  AbstractTool parentTool
          parent tool
private  java.util.Vector<AbstractTool> subTools
          sub tools
private  TextAntialiasing textAntialiasing
          text aliasing
private  View2D view2D
          the view where this tool instance is registred
 
Constructor Summary
AbstractTool()
           
 
Method Summary
 void addToolListener(ToolListener listener)
          add a tool listener of this tool
private  void fireControlStateChanged()
          fire a state changed
 Antialiasing getAntialiasing()
          return true if anti alias is required, false otherwise
 java.util.Vector<ToolControl> getControls()
          get the tool controls
 java.util.Vector<ToolControl> getControls(int toolControlType)
          get the tool control with specified type
 Fractional getFractional()
          return Fractional
 Interpolation getInterpolation()
          get the interpolation
 java.util.Vector<AbstractTool.KeyboardAction> getKeyboardActions()
          get the keyboard action
 java.lang.String getName()
          get the tool name
 AbstractTool getParentTool()
          get the parent tool
 java.util.Vector<AbstractTool> getSubTools()
          get the sub tools that have been registered in window
 TextAntialiasing getTextAntialiasing()
          get the text antialiasing *
 View2D getView2D()
          get view2D
abstract  void interceptKeyPressed(java.awt.event.KeyEvent e)
           
abstract  void interceptKeyReleased(java.awt.event.KeyEvent e)
           
abstract  void interceptKeyTyped(java.awt.event.KeyEvent e)
           
abstract  void interceptMouseClicked(java.awt.event.MouseEvent e)
          intercept the device mouse clicked
abstract  void interceptMouseDragged(java.awt.event.MouseEvent e)
          intercept the device mouse dragged event
abstract  void interceptMouseEntered(java.awt.event.MouseEvent e)
          intercept the device mouse entered
abstract  void interceptMouseExited(java.awt.event.MouseEvent e)
          intercept the device mouse exited
abstract  void interceptMouseMoved(java.awt.event.MouseEvent e)
          intercept the device mouse move
abstract  void interceptMousePressed(java.awt.event.MouseEvent e)
          intercept the device mouse entered
abstract  void interceptMouseReleased(java.awt.event.MouseEvent e)
          intercept the device mouse released
abstract  void interceptMouseWheelMoved(java.awt.event.MouseWheelEvent e)
          intercept the device mouse wheel
 boolean isLockSelected()
          return true if tool is selected , false otherwise
 void lockSelected()
          lock select the tool and fire event for toolListener
 void paint(java.awt.Graphics2D g2d)
           
abstract  void paintTool(java.awt.Graphics2D g2d)
          paint the tool in device
 void registerControl(ToolControl toolControl)
          register the specified tool control
 void registerKeyboardAction(javax.swing.AbstractAction action, javax.swing.KeyStroke ks, int condition)
          register a keyboard action mapping within tool action and keyboard input
 void registerSubTool(AbstractTool subTool)
          register subTool for this tool
 void setAntialiasing(Antialiasing antialiasing)
          set the antialiasing
 void setFractional(Fractional fractional)
          set the fractional
 void setInterpolation(Interpolation interpolation)
          set the interpolation
 void setKeyboardActions(java.util.Vector<AbstractTool.KeyboardAction> keyboardActions)
          set the keyboard actions
 void setName(java.lang.String name)
          set tool name
 void setParentTool(AbstractTool parentTool)
          set the parent tool
private  void setQuality(java.awt.Graphics2D g2d)
          set the rendering quality for painting this layout
 void setTextAntialiasing(TextAntialiasing textAntialiasing)
          set the text antialiasing
 void setView2D(View2D view2D)
          set viewd2D
 void unlockSelected()
          unlock the tool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private java.lang.String name
the tool name


view2D

private View2D view2D
the view where this tool instance is registred


parentTool

private AbstractTool parentTool
parent tool


subTools

private java.util.Vector<AbstractTool> subTools
sub tools


listenerList

private javax.swing.event.EventListenerList listenerList
listeners


lockSelected

private boolean lockSelected
lock selected


keyboardActions

private java.util.Vector<AbstractTool.KeyboardAction> keyboardActions
keyboard actions


controls

private java.util.Vector<ToolControl> controls
tool controls


interpolation

private Interpolation interpolation
interpolation


antialiasing

private Antialiasing antialiasing
aliasing


textAntialiasing

private TextAntialiasing textAntialiasing
text aliasing


fractional

private Fractional fractional
fractional

Constructor Detail

AbstractTool

public AbstractTool()
Method Detail

getParentTool

public AbstractTool getParentTool()
get the parent tool

Returns:
the parent tool

setParentTool

public void setParentTool(AbstractTool parentTool)
set the parent tool

Parameters:
parentTool -

getView2D

public View2D getView2D()
get view2D

Returns:

setView2D

public void setView2D(View2D view2D)
set viewd2D

Parameters:
view2D -

interceptMouseDragged

public abstract void interceptMouseDragged(java.awt.event.MouseEvent e)
intercept the device mouse dragged event

Parameters:
e -

interceptMouseMoved

public abstract void interceptMouseMoved(java.awt.event.MouseEvent e)
intercept the device mouse move

Parameters:
e -

interceptMouseClicked

public abstract void interceptMouseClicked(java.awt.event.MouseEvent e)
intercept the device mouse clicked

Parameters:
e -

interceptMouseEntered

public abstract void interceptMouseEntered(java.awt.event.MouseEvent e)
intercept the device mouse entered

Parameters:
e -

interceptMouseExited

public abstract void interceptMouseExited(java.awt.event.MouseEvent e)
intercept the device mouse exited

Parameters:
e -

interceptMousePressed

public abstract void interceptMousePressed(java.awt.event.MouseEvent e)
intercept the device mouse entered

Parameters:
e -

interceptMouseReleased

public abstract void interceptMouseReleased(java.awt.event.MouseEvent e)
intercept the device mouse released

Parameters:
e -

interceptMouseWheelMoved

public abstract void interceptMouseWheelMoved(java.awt.event.MouseWheelEvent e)
intercept the device mouse wheel

Parameters:
e -

interceptKeyPressed

public abstract void interceptKeyPressed(java.awt.event.KeyEvent e)

interceptKeyReleased

public abstract void interceptKeyReleased(java.awt.event.KeyEvent e)

interceptKeyTyped

public abstract void interceptKeyTyped(java.awt.event.KeyEvent e)

paintTool

public abstract void paintTool(java.awt.Graphics2D g2d)
paint the tool in device

Parameters:
g2d -

paint

public final void paint(java.awt.Graphics2D g2d)

lockSelected

public void lockSelected()
lock select the tool and fire event for toolListener


fireControlStateChanged

private void fireControlStateChanged()
fire a state changed


unlockSelected

public void unlockSelected()
unlock the tool


isLockSelected

public boolean isLockSelected()
return true if tool is selected , false otherwise

Returns:
the lock select

getName

public java.lang.String getName()
get the tool name

Returns:
the tool name

setName

public void setName(java.lang.String name)
set tool name

Parameters:
name -

getKeyboardActions

public java.util.Vector<AbstractTool.KeyboardAction> getKeyboardActions()
get the keyboard action

Returns:
the keyboard actions action/key mapping

setKeyboardActions

public void setKeyboardActions(java.util.Vector<AbstractTool.KeyboardAction> keyboardActions)
set the keyboard actions

Parameters:
keyboardActions -

getInterpolation

public Interpolation getInterpolation()
get the interpolation

Returns:

setInterpolation

public void setInterpolation(Interpolation interpolation)
set the interpolation

Parameters:
value -

getAntialiasing

public Antialiasing getAntialiasing()
return true if anti alias is required, false otherwise

Returns:
antialiasing

setAntialiasing

public void setAntialiasing(Antialiasing antialiasing)
set the antialiasing

Parameters:
antialias -

setFractional

public void setFractional(Fractional fractional)
set the fractional

Parameters:
fractional -

getFractional

public Fractional getFractional()
return Fractional

Returns:
fractional

getTextAntialiasing

public TextAntialiasing getTextAntialiasing()
get the text antialiasing *

Returns:
textAntialiasing

setTextAntialiasing

public void setTextAntialiasing(TextAntialiasing textAntialiasing)
set the text antialiasing

Parameters:
textAntialiasing -

setQuality

private void setQuality(java.awt.Graphics2D g2d)
set the rendering quality for painting this layout

Parameters:
g2d -

registerKeyboardAction

public void registerKeyboardAction(javax.swing.AbstractAction action,
                                   javax.swing.KeyStroke ks,
                                   int condition)
register a keyboard action mapping within tool action and keyboard input

Parameters:
action -
ks -
condition -

registerControl

public void registerControl(ToolControl toolControl)
register the specified tool control

Parameters:
the - tool control to registered

getControls

public java.util.Vector<ToolControl> getControls()
get the tool controls

Returns:
the tool controls

getControls

public java.util.Vector<ToolControl> getControls(int toolControlType)
get the tool control with specified type

Returns:
the tool controls

registerSubTool

public void registerSubTool(AbstractTool subTool)
register subTool for this tool

Parameters:
subTool -

getSubTools

public java.util.Vector<AbstractTool> getSubTools()
get the sub tools that have been registered in window

Returns:

addToolListener

public void addToolListener(ToolListener listener)
add a tool listener of this tool

Parameters:
listener -