de.matthiasmann.twl
Class MenuAction

java.lang.Object
  extended by de.matthiasmann.twl.MenuElement
      extended by de.matthiasmann.twl.MenuAction

public class MenuAction
extends MenuElement


Constructor Summary
MenuAction()
           
MenuAction(java.lang.Runnable cb)
           
MenuAction(java.lang.String name, java.lang.Runnable cb)
          Creates a menu action which displays the given name and invokes the specified callback when activated.
 
Method Summary
protected  Widget createMenuWidget(MenuManager mm, int level)
           
 java.lang.Runnable getCallback()
           
 void setCallback(java.lang.Runnable cb)
          Sets the callback to invoke when the menu action is triggered.
 
Methods inherited from class de.matthiasmann.twl.MenuElement
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getAlignment, getName, getTheme, getTooltipContent, isEnabled, removePropertyChangeListener, removePropertyChangeListener, setAlignment, setEnabled, setName, setTheme, setTooltipContent, setWidgetTheme
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuAction

public MenuAction()

MenuAction

public MenuAction(java.lang.Runnable cb)

MenuAction

public MenuAction(java.lang.String name,
                  java.lang.Runnable cb)
Creates a menu action which displays the given name and invokes the specified callback when activated.

Parameters:
name - the name/text of the menu action
cb - the callback to invoke
See Also:
setCallback(java.lang.Runnable)
Method Detail

getCallback

public java.lang.Runnable getCallback()

setCallback

public void setCallback(java.lang.Runnable cb)
Sets the callback to invoke when the menu action is triggered.

this callback is invoked after the menu is closed.

Parameters:
cb - the callback (can be null)

createMenuWidget

protected Widget createMenuWidget(MenuManager mm,
                                  int level)
Specified by:
createMenuWidget in class MenuElement