torero.gui
Class TraversalTool

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

public class TraversalTool
extends Object
implements ToreroTool

The traversal tool class is used to assign traversals to productions. The visual component is included in the class. On an appropriate call to the processUI() method it opens the tool's window. All public accessable functionality is contained in the processUI method. Note in this grammarmodel traversals are assigned to the left-hand side of a production and not to the production itself. The implementations is quite similar to the AttributeTool.

See Also:
AttributeGrammar, GrammarNode

Constructor Summary
TraversalTool(ProductionModel productions, TraversalModel traversals)
          Creates a new TraversalTool.
 
Method Summary
 void activate()
          Activates (resets) this tool.
 void deactivate()
          Deactivates (resets) this 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.
 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

TraversalTool

public TraversalTool(ProductionModel productions,
                     TraversalModel traversals)
Creates a new TraversalTool.
Parameters:
productions - the underlying Productionmodel
traversals - the underlying TraversalModel
Method Detail

processUI

public void processUI(GrammarNode gn,
                      MouseEvent me,
                      Attribute att)
Process the mouseevent me at node gn at attribute att. The selected symbol (lefthandside of the affected production) is set to gn.getListElement.getRefSymbol() and the visual component is updated.
Specified by:
processUI in interface ToreroTool
Parameters:
gn - affected grammarnode.
me - the mouseevent that occured.
att - the affected attribute.

activate

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

deactivate

public void deactivate()
Deactivates (resets) this tool.
Specified by:
deactivate in interface ToreroTool

pluggedIn

public void pluggedIn(ToreroToolBox ttb)
Called when the tool is plugged into the ToreroToolBox. The visual component is constructed, the size is set but it's still hidden.
Specified by:
pluggedIn in interface ToreroTool
Parameters:
ttb - a reference to the unique torerotoolbox, for callback fuctions.

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.