torero.gui
Class ConnectTool

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

public class ConnectTool
extends Object
implements ToreroTool

The connect tool class is used to construct attibute assignments between attributes. This tool has no visual component, but it changes the cursor according to the tool's state. All public accessable functionality is contained in the processUI method.

See Also:
GrammarNode, AttributeAssingnment

Constructor Summary
ConnectTool()
           
 
Method Summary
 void activate()
          Activates and resets this tool.
 void deactivate()
          Deactivates (resets) this tool, resets the cursor to the state before activating the tool.
 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.
 boolean mkAttrib2Traversal(GrammarNode srcnode, Attribute srcattrib, GrammarNode destnode, Attribute destattrib)
          Connects an attribute and a traversal.
 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.
 void reset()
          Resets the tool, setting the state to source-select and changing the cursor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectTool

public ConnectTool()
Method Detail

processUI

public void processUI(GrammarNode gn,
                      MouseEvent me,
                      Attribute att)
Process the mouseevent me at node gn at attribute att. The tool can be in two states: source-select and destination-select. The actions taken are depending on this state. source-select: gn and att are stored to build up the source of the assignment. dest-select: plausibility checks are done and the assignment is created.
Specified by:
processUI in interface ToreroTool
Parameters:
gn - affected grammarnode.
me - the mouseevent that occured.
att - the affected attribute.

mkAttrib2Traversal

public boolean mkAttrib2Traversal(GrammarNode srcnode,
                                  Attribute srcattrib,
                                  GrammarNode destnode,
                                  Attribute destattrib)
Connects an attribute and a traversal.

activate

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

reset

public void reset()
Resets the tool, setting the state to source-select and changing the cursor.

deactivate

public void deactivate()
Deactivates (resets) this tool, resets the cursor to the state before activating the tool. Must be called before plugged out (this is done by the torerotoolbox, so don't worry).
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 and replaces the actual cursor.
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.