org.jdesktop.wonderland.client.contextmenu
Class ContextMenuItem

java.lang.Object
  extended by org.jdesktop.wonderland.client.contextmenu.ContextMenuItem
Direct Known Subclasses:
SimpleContextMenuItem

public abstract class ContextMenuItem
extends java.lang.Object

Represents an abstract item in the context menu of a certain type. Each item has a name and state (ENABLED/DISABLED). The ContextMenuItem has an event mechanism to indicate when some aspect of the context menu item has been changed and needs to be repainted.

Author:
Jordan Slott

Nested Class Summary
static interface ContextMenuItem.MenuItemRepaintListener
          A listener that informs when the menu item needs to be visually updated.
 
Constructor Summary
ContextMenuItem(java.lang.String label)
           
 
Method Summary
 void addMenuItemRepaintListener(ContextMenuItem.MenuItemRepaintListener listener)
          Adds a new listener for events when the menu item has been changed.
 void fireMenuItemRepaintListeners()
          Tells all listeners that the menu item has been changed.
 java.lang.String getLabel()
          Returns the label of the menu item.
 boolean isEnabled()
          Returns true if the context menu item is enabled, false if not.
 void removeMenuItemRepaintListener(ContextMenuItem.MenuItemRepaintListener listener)
          Removes a listener for the menu item changed events.
 void setEnabled(boolean isEnabled)
          Sets whether the context menu item is enabled.
 void setLabel(java.lang.String label)
          Sets the label of the menu item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextMenuItem

public ContextMenuItem(java.lang.String label)
Method Detail

isEnabled

public boolean isEnabled()
Returns true if the context menu item is enabled, false if not.

Returns:
True if enabled, false if not

setEnabled

public void setEnabled(boolean isEnabled)
Sets whether the context menu item is enabled.

Parameters:
isEnabled - True to enabled the menu item, false to not

getLabel

public java.lang.String getLabel()
Returns the label of the menu item.

Returns:
The String menu item label

setLabel

public void setLabel(java.lang.String label)
Sets the label of the menu item.

Parameters:
label - The new label of the menu item

addMenuItemRepaintListener

public void addMenuItemRepaintListener(ContextMenuItem.MenuItemRepaintListener listener)
Adds a new listener for events when the menu item has been changed. Only a single instance of the menu item repaint listener may be added.

Parameters:
listener - A new MenuItemRepaintListener

removeMenuItemRepaintListener

public void removeMenuItemRepaintListener(ContextMenuItem.MenuItemRepaintListener listener)
Removes a listener for the menu item changed events. If the listener does not exist, this method does nothing.

Parameters:
listener - The listener to remove, if it exists

fireMenuItemRepaintListeners

public void fireMenuItemRepaintListeners()
Tells all listeners that the menu item has been changed.



Open Wonderland - http://openwonderland.org