de.saar.chorus.ubench
Class Fragment

Object
  extended by Fragment
All Implemented Interfaces:
ActionListener, EventListener

public class Fragment
extends Object

A fragment in a dominance graph. This fragment contains nodes (labelled and unlabelled) and solid edges, such that the contained nodes are all connected by the contained edges. Fragments of a dominance graph are actually computed by the computeFragments method in JDomGraph. Objects of this class can serve as popup targets, i.e. they provide a menu item for a popup menu.

Author:
Alexander Koller

Method Summary
 void actionPerformed(ActionEvent e)
           
 void addMenuItem(String id, String label)
          Adds a menu item to the popup target's menu.
 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.
 Set<DefaultGraphCell> getNodes()
          Get all nodes in this fragment.
 JDomGraph getParent()
           
 int size()
          Get the number of nodes in this fragment.
 String toString()
           
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getNodes

public Set<DefaultGraphCell> getNodes()
Get all nodes in this fragment.

Returns:
the set of all nodes.

size

public int size()
Get the number of nodes in this fragment.

Returns:
the number of nodes.

toString

public String toString()
Overrides:
toString in class Object

getMenuLabel

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

Returns:
the menu item label.

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.