com.novell.nds.dirxml.util
Class MenuItem

java.lang.Object
  extended bycom.novell.nds.dirxml.util.MenuItem
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
CheckedMenuItem

public class MenuItem
extends Object
implements Runnable

Abstract class for use with the Menu class.

See Also:
Menu

Field Summary
protected  String displayString
           
protected  boolean exit
           
 
Constructor Summary
protected MenuItem()
          Constructor for derived classes.
  MenuItem(String displayString)
          Constructor for using this class for a generic menu entry.
  MenuItem(String displayString, boolean exitAfterSelect)
          Constructor for using this class for a generic menu entry.
 
Method Summary
 boolean exitAfterRun()
          Return true if the Menu should be exited after the MenuItem has been selected and run.
 String getDisplayString()
          Return the string to display as the menu choice.
 void run()
          Called when MenuItem is selected by the user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

displayString

protected String displayString

exit

protected boolean exit
Constructor Detail

MenuItem

protected MenuItem()
Constructor for derived classes.

Derived classes must override exitAfterRun() if they want it to return true;


MenuItem

public MenuItem(String displayString)
Constructor for using this class for a generic menu entry. Instances constructed using this constructor will always return true from exitAfterRun().

Parameters:
displayString - menu item text

MenuItem

public MenuItem(String displayString,
                boolean exitAfterSelect)
Constructor for using this class for a generic menu entry.

Parameters:
displayString - menu item text
exitAfterSelect - value that exitAfterRun() will return.
Method Detail

run

public void run()
Called when MenuItem is selected by the user.

Default implementation does nothing.

Specified by:
run in interface Runnable

getDisplayString

public String getDisplayString()
Return the string to display as the menu choice.

Returns:
menu choice text

exitAfterRun

public boolean exitAfterRun()
Return true if the Menu should be exited after the MenuItem has been selected and run.

Returns:
true if Menu should exit after run() is called.