com.novell.nds.dirxml.util
Class CheckedMenuItem

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

public class CheckedMenuItem
extends MenuItem

Abstract class for use with the Menu class.

See Also:
Menu

Field Summary
protected  boolean state
           
 
Fields inherited from class com.novell.nds.dirxml.util.MenuItem
displayString, exit
 
Constructor Summary
protected CheckedMenuItem()
          Constructor for derived classes.
  CheckedMenuItem(String displayString, boolean initiallyChecked)
          Constructor for using this class for a generic menu entry.
 
Method Summary
 String getDisplayString()
          Return the string to display as the menu choice.
 boolean isChecked()
          Return true if this item's state is checked, false otherwise.
 void run()
          Called when MenuItem is selected by the user.
 
Methods inherited from class com.novell.nds.dirxml.util.MenuItem
exitAfterRun
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

state

protected boolean state
Constructor Detail

CheckedMenuItem

protected CheckedMenuItem()
Constructor for derived classes.

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


CheckedMenuItem

public CheckedMenuItem(String displayString,
                       boolean initiallyChecked)
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
Method Detail

isChecked

public boolean isChecked()
Return true if this item's state is checked, false otherwise.

Returns:
true or false

run

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

Default implementation toggles state

Specified by:
run in interface Runnable
Overrides:
run in class MenuItem

getDisplayString

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

Overrides:
getDisplayString in class MenuItem
Returns:
menu choice text