de.matthiasmann.twl
Class MenuElement

java.lang.Object
  extended by de.matthiasmann.twl.MenuElement
Direct Known Subclasses:
Menu, MenuAction, MenuCheckbox, MenuSpacer

public abstract class MenuElement
extends java.lang.Object


Constructor Summary
MenuElement()
           
MenuElement(java.lang.String name)
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
protected abstract  Widget createMenuWidget(MenuManager mm, int level)
           
protected  void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
           
 Alignment getAlignment()
           
 java.lang.String getName()
           
 java.lang.String getTheme()
           
 java.lang.Object getTooltipContent()
           
 boolean isEnabled()
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 MenuElement setAlignment(Alignment alignment)
          Sets the alignment used for this element in the menubar.
 MenuElement setEnabled(boolean enabled)
           
 MenuElement setName(java.lang.String name)
           
 MenuElement setTheme(java.lang.String theme)
           
 MenuElement setTooltipContent(java.lang.Object tooltip)
           
protected  void setWidgetTheme(Widget w, java.lang.String defaultTheme)
          Helper method to apply the theme from the menu element to the widget if it was set, otherwise the defaultTheme is used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuElement

public MenuElement()

MenuElement

public MenuElement(java.lang.String name)
Method Detail

getName

public java.lang.String getName()

setName

public MenuElement setName(java.lang.String name)

getTheme

public java.lang.String getTheme()

setTheme

public MenuElement setTheme(java.lang.String theme)

isEnabled

public boolean isEnabled()

setEnabled

public MenuElement setEnabled(boolean enabled)

getTooltipContent

public java.lang.Object getTooltipContent()

setTooltipContent

public MenuElement setTooltipContent(java.lang.Object tooltip)

getAlignment

public Alignment getAlignment()

setAlignment

public MenuElement setAlignment(Alignment alignment)
Sets the alignment used for this element in the menubar. The default value is null which means that the class based default is used.

Parameters:
alignment - the alignment or null.
Returns:
this
See Also:
Menu.setClassAlignment(java.lang.Class, de.matthiasmann.twl.Alignment), Menu.getClassAlignment(java.lang.Class)

createMenuWidget

protected abstract Widget createMenuWidget(MenuManager mm,
                                           int level)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  boolean oldValue,
                                  boolean newValue)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  int oldValue,
                                  int newValue)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)

setWidgetTheme

protected void setWidgetTheme(Widget w,
                              java.lang.String defaultTheme)
Helper method to apply the theme from the menu element to the widget if it was set, otherwise the defaultTheme is used.

Parameters:
w - the Widget to which the theme should be applied
defaultTheme - the defaultTheme when none was set