torero.gui
Class ToreroToolBox

java.lang.Object
  |
  +--torero.gui.ToreroToolBox

public class ToreroToolBox
extends Object

The container used for ToreroTools. It generates a graphical representation of the tools - called the Torero Toolbar. Note that this is a singleton class.

See Also:
ToreroTool

Method Summary
 void addTool(ToreroTool tool)
          Adds a tool to the toolbox.
 Component getParentComponent()
          Get the parent component of the toolbox.
 JLabel getStatusLabel()
          Get an emtpy statuslabel with black LineBorder and Black Foreground.
 JPanel getToolBarPanel()
          Get a panel representing the toolbar.
 JMenu getToolMenu()
          Get menu entries for all (plugged in) tools.
static ToreroToolBox getUnique()
          Get the singleton toolbox.
 void printError(String msg, long msec)
          Prints an errormessage (color red) to the status line.
 void printStatus(String msg, long msec)
          Prints a message to the status line.
 void processUI(GrammarNode gn, MouseEvent me, Attribute att)
          Calls processUI on the active tool and forwards all the parameters unchanged.
 void setBackActiveTool()
          Calls the activate method of the active tool.
 void setParentComponent(Component parent)
          Sets the parent component of the toolbox.
 void setTreeModel(DefaultTreeModel dtm, GrammarNode gn)
          Sets the treemodel that will informed whenn changes occur.
 void updateTreeModel()
          Causes the TreeModel to update its entries and to repaint (if necessary).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getUnique

public static ToreroToolBox getUnique()
Get the singleton toolbox.
Returns:
the singleton toolbox.

setParentComponent

public void setParentComponent(Component parent)
Sets the parent component of the toolbox. Note that is absolutely necessary for the toolbox to have a parent component, because it needs this to draw the toolbar.
Parameters:
parent. -  

processUI

public void processUI(GrammarNode gn,
                      MouseEvent me,
                      Attribute att)
Calls processUI on the active tool and forwards all the parameters unchanged.
Parameters:
gn - affected grammarnode.
me - the mouseevent that occured.
att - the affected attribute.

addTool

public void addTool(ToreroTool tool)
Adds a tool to the toolbox. Deactivates the active tool.
Parameters:
tool - the tool to add.

getParentComponent

public Component getParentComponent()
Get the parent component of the toolbox.
Returns:
the parent component of this toolbox.

getToolBarPanel

public JPanel getToolBarPanel()
Get a panel representing the toolbar.
Returns:
the panel representing the toolbar.

getToolMenu

public JMenu getToolMenu()
Get menu entries for all (plugged in) tools.
Returns:
the menu entry representing all (plugged in) tools.

getStatusLabel

public JLabel getStatusLabel()
Get an emtpy statuslabel with black LineBorder and Black Foreground.
Returns:
an emty statuslabel.

printStatus

public void printStatus(String msg,
                        long msec)
Prints a message to the status line.
Parameters:
msg - the message to print
msec - time in milliseconds for displaying this message

printError

public void printError(String msg,
                       long msec)
Prints an errormessage (color red) to the status line.
Parameters:
msg - the message to print
msec - time in milliseconds for displaying this message

setBackActiveTool

public void setBackActiveTool()
Calls the activate method of the active tool.

updateTreeModel

public void updateTreeModel()
Causes the TreeModel to update its entries and to repaint (if necessary). Important: This method asssumes that the TreeModel consists of Node from type GrammarNode, and will throw a ClassCastException otherwise.

setTreeModel

public void setTreeModel(DefaultTreeModel dtm,
                         GrammarNode gn)
Sets the treemodel that will informed whenn changes occur. Calls updateTreeModel()
Parameters:
dtm - the treemodel
gn - the root node