de.saar.chorus.ubench
Class NodeData

Object
  extended by NodeData
All Implemented Interfaces:
INodeData<NodeType>, ActionListener, EventListener

public class NodeData
extends Object
implements INodeData<NodeType>

The data that can be stored in the node of a dominance graph -- namely, a name, a label, and a node type. In addition, objects of this class can serve as popup targets, i.e. they provide a menu item for a popup menu.

Author:
Alexander Koller

Constructor Summary
NodeData(NodeType type, String name, JDomGraph parent)
          New node data for an unlabelled node.
NodeData(NodeType type, String name, String label, JDomGraph parent)
          New node data for a labelled node (with label).
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void addMenuItem(String id, String label)
          Adds a menu item to the popup target's menu.
 String getDesc()
           
 String getLabel()
           
 JMenuItem getMenu()
          Return the JMenu object that represents this popup target's submenu.
 String getMenuLabel()
          Returns the label of the menu item for this popup target in a superordinate menu.
 String getName()
           
 JDomGraph getParent()
           
 String getToolTipText()
           
 NodeType getType()
           
 void setShowLabel(boolean b)
           
 String toString()
           
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeData

public NodeData(NodeType type,
                String name,
                String label,
                JDomGraph parent)
New node data for a labelled node (with label).

Parameters:
name -
label -
type -

NodeData

public NodeData(NodeType type,
                String name,
                JDomGraph parent)
New node data for an unlabelled node.

Parameters:
name -
type -
Method Detail

getMenuLabel

public String getMenuLabel()
Returns the label of the menu item for this popup target in a superordinate menu.

Returns:
the menu item label.

getLabel

public String getLabel()
Returns:
Returns the label.

getName

public String getName()
Returns:
Returns the name.

getType

public NodeType getType()
Specified by:
getType in interface INodeData<NodeType>
Returns:
Returns the type.

getDesc

public String getDesc()

toString

public String toString()
Overrides:
toString in class Object

setShowLabel

public void setShowLabel(boolean b)

getToolTipText

public String getToolTipText()
Specified by:
getToolTipText in interface INodeData<NodeType>

getMenu

public JMenuItem getMenu()
Return the JMenu object that represents this popup target's submenu.

Returns:
the JMenu object.

addMenuItem

public void addMenuItem(String id,
                        String label)
Adds a menu item to the popup target's menu. The item has an ID and a label. The label specifies what is displayed when the menu item is drawn. The ID is sent to the popup listeners when the user clicks on the item.

Parameters:
id - an identification for this menu item
label - the label that will be displayed for this menu item.

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

getParent

public JDomGraph getParent()
Returns:
Returns the parent.