torero.gui
Class SwapTool

java.lang.Object
  |
  +--torero.gui.SwapTool
All Implemented Interfaces:
ToreroTool

public class SwapTool
extends Object
implements ToreroTool

The swap tool class is used to swap to symbols in a grammar. It is only implemented for testing. It has no visual component, only the cursor is changed, when activating this tool. All public accessable functionality is contained in the processUI method.

See Also:
Grammar

Constructor Summary
SwapTool()
           
 
Method Summary
 void activate()
          Activates (resets) this tool, and changes the cursor.
 void deactivate()
          Deactivates (resets) this tool, and restores the cursor.
 String getDescription()
          Get a textual description of the tool (e.g. one sentence).
 String getShortDescription()
          Get a short textual description of the tool (a few words).
 Icon getToolIcon()
          Get the icon for this tool.
 void pluggedIn(ToreroToolBox ttb)
          Called when the tool is plugged into the ToreroToolBox.
 void pluggedOut()
          Called when the tool is removed from the ToreroToolBox.
 void processUI(GrammarNode gn, MouseEvent me, Attribute att)
          Process the mouseevent me at node gn at attribute att.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwapTool

public SwapTool()
Method Detail

processUI

public void processUI(GrammarNode gn,
                      MouseEvent me,
                      Attribute att)
Process the mouseevent me at node gn at attribute att. The first call to this method stores the selected symbol an sets the tool's state to destination-select. The next call swaps the previously stored symbol with the acutal selected symbol and set's the tool's state back to src-select.
Specified by:
processUI in interface ToreroTool
Parameters:
gn - affected grammarnode.
me - the mouseevent that occured.
att - the affected attribute.
See Also:
GrammarNode

activate

public void activate()
Activates (resets) this tool, and changes the cursor.
Specified by:
activate in interface ToreroTool

deactivate

public void deactivate()
Deactivates (resets) this tool, and restores the cursor.
Specified by:
deactivate in interface ToreroTool

pluggedIn

public void pluggedIn(ToreroToolBox ttb)
Called when the tool is plugged into the ToreroToolBox. Activates the tool. It stores the old cursor creates a new one but dosn't display it now.
Specified by:
pluggedIn in interface ToreroTool

pluggedOut

public void pluggedOut()
Called when the tool is removed from the ToreroToolBox.
Specified by:
pluggedOut in interface ToreroTool

getToolIcon

public Icon getToolIcon()
Get the icon for this tool.
Specified by:
getToolIcon in interface ToreroTool
Returns:
the Icon for this tool.

getShortDescription

public String getShortDescription()
Get a short textual description of the tool (a few words).
Specified by:
getShortDescription in interface ToreroTool
Returns:
a short textual description.

getDescription

public String getDescription()
Get a textual description of the tool (e.g. one sentence).
Specified by:
getDescription in interface ToreroTool
Returns:
a textual description.