EchoPoint
1.0

echopoint
Class MenuItem

java.lang.Object
  extended bynextapp.echo.Component
      extended bynextapp.echo.AbstractButton
          extended byechopoint.MenuItem
All Implemented Interfaces:
ReflectionSetter, java.io.Serializable, nextapp.echo.ToolTipSupport
Direct Known Subclasses:
Menu

public class MenuItem
extends nextapp.echo.AbstractButton
implements ReflectionSetter

The MenuItem class provides a Component that can be added to a menu bar or other menu items.

Author:
Brad Baker
See Also:
Serialized Form

Nested Class Summary
static class MenuItem.NestedStyleInfo
          Nested public static StyleInfo class.
 
Field Summary
static java.lang.String BORDER_COLOR_CHANGED_PROPERTY
          Property Change Names
protected  nextapp.echo.Color borderColor
           
protected  nextapp.echo.Color rolloverColor
           
static java.lang.String STYLE_BORDER_COLOR
          A style constant for the Border Color property.
static java.lang.String STYLE_ROLLOVER_BORDER_COLOR
          A style constant for the Rollover Border Color property.
static java.lang.String TEXT_ALIGNMENT_CHANGED_PROPERTY
           
 
Fields inherited from class nextapp.echo.AbstractButton
ACTION_COMMAND_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, ICON_TEXT_MARGIN_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, ROLLOVER_BACKGROUND_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_FONT_CHANGED_PROPERTY, ROLLOVER_FOREGROUND_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, STYLE_HORIZONTAL_ALIGNMENT, STYLE_HORIZONTAL_TEXT_POSITION, STYLE_ICON_TEXT_MARGIN, STYLE_ROLLOVER_BACKGROUND, STYLE_ROLLOVER_ENABLED, STYLE_ROLLOVER_FONT, STYLE_ROLLOVER_FOREGROUND, STYLE_VERTICAL_ALIGNMENT, STYLE_VERTICAL_TEXT_POSITION, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
Fields inherited from class nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, listenerList, LOCALE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface nextapp.echo.ToolTipSupport
TOOL_TIP_TEXT_CHANGED_PROPERTY
 
Constructor Summary
MenuItem()
          Creates a button with no text or icon.
MenuItem(nextapp.echo.ImageReference icon)
          Creates a button with an icon.
MenuItem(java.lang.String text)
          Creates a button with text.
MenuItem(java.lang.String text, nextapp.echo.ImageReference icon)
          Creates a button with text and an icon.
 
Method Summary
 void applyStyle(nextapp.echo.Style style)
          Applies the provided style to the component.
 nextapp.echo.Color getBorderColor()
           
 int getId()
          Returns the unique and immutable Id of the MenuItem
 nextapp.echo.Color getRolloverBorderColor()
           
 java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue)
          Called to save the old value of a field, set in a new value and return the old value of a field.
 void setBorderColor(nextapp.echo.Color newBorderColor)
          Sets the Color of the border around MenuItem's text.
 void setRolloverBorderColor(nextapp.echo.Color newBorderColor)
          Sets the Color of the border around the MenuItem's text when the mouse is over the menu item.
 java.lang.String toString()
           
 
Methods inherited from class nextapp.echo.AbstractButton
addActionListener, addChangeListener, addItemListener, doAction, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextMargin, getModel, getRolloverBackground, getRolloverFont, getRolloverForeground, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getText, getToolTipText, getVerticalAlignment, getVerticalTextPosition, hasActionListeners, isRolloverEnabled, isSelected, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextMargin, setModel, setRolloverBackground, setRolloverEnabled, setRolloverFont, setRolloverForeground, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setToolTipText, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class nextapp.echo.Component
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getLocale, getParent, indexOf, init, isAncestorOf, isEnabled, isRegistered, isShowing, isVisible, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFont, setForeground, setIdentifier, setLocale, setVisible, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STYLE_BORDER_COLOR

public static final java.lang.String STYLE_BORDER_COLOR
A style constant for the Border Color property. Values of this key must be of type nextapp.echo.Color.

See Also:
Constant Field Values

STYLE_ROLLOVER_BORDER_COLOR

public static final java.lang.String STYLE_ROLLOVER_BORDER_COLOR
A style constant for the Rollover Border Color property. Values of this key must be of type nextapp.echo.Color.

See Also:
Constant Field Values

BORDER_COLOR_CHANGED_PROPERTY

public static final java.lang.String BORDER_COLOR_CHANGED_PROPERTY
Property Change Names

See Also:
Constant Field Values

TEXT_ALIGNMENT_CHANGED_PROPERTY

public static final java.lang.String TEXT_ALIGNMENT_CHANGED_PROPERTY
See Also:
Constant Field Values

borderColor

protected nextapp.echo.Color borderColor

rolloverColor

protected nextapp.echo.Color rolloverColor
Constructor Detail

MenuItem

public MenuItem()
Creates a button with no text or icon.


MenuItem

public MenuItem(java.lang.String text)
Creates a button with text.

Parameters:
text - A text label to display in the button.

MenuItem

public MenuItem(java.lang.String text,
                nextapp.echo.ImageReference icon)
Creates a button with text and an icon.

Parameters:
text - A text label to display in the button.
icon - An icon to display in the button.

MenuItem

public MenuItem(nextapp.echo.ImageReference icon)
Creates a button with an icon.

Parameters:
icon - An icon to display in the button.
Method Detail

applyStyle

public void applyStyle(nextapp.echo.Style style)
Applies the provided style to the component. The base nextapp.echo.Component style names can be used as well.


getBorderColor

public nextapp.echo.Color getBorderColor()
Returns:
The Color of the border around MenuItem's text.

getId

public int getId()
Returns the unique and immutable Id of the MenuItem

Returns:
Id

getRolloverBorderColor

public nextapp.echo.Color getRolloverBorderColor()
Returns:
The Color of the border around the MenuItem's text when the mouse if over the menu item.

setBorderColor

public void setBorderColor(nextapp.echo.Color newBorderColor)
Sets the Color of the border around MenuItem's text.
This methods fires a PropertyChangeEvent with a getPropertyName() value of MenuItem.BORDER_COLOR_CHANGED_PROPERTY


setRolloverBorderColor

public void setRolloverBorderColor(nextapp.echo.Color newBorderColor)
Sets the Color of the border around the MenuItem's text when the mouse is over the menu item.
This methods fires a PropertyChangeEvent with a getPropertyName() value of MenuItem.BORDER_COLOR_CHANGED_PROPERTY


toString

public java.lang.String toString()

set

public java.lang.Object set(java.lang.reflect.Field field,
                            java.lang.Object newValue)
                     throws java.lang.Exception
Description copied from interface: ReflectionSetter
Called to save the old value of a field, set in a new value and return the old value of a field. This interface allows a field set operation to be "delegated" back into the class that has permission to perform the field set.

 public Object set(Field f, Object newValue) throws Exception {
      Object oldValue = f.get(this);
      f.set(this,newValue);
      return oldValue;
 }
 

Specified by:
set in interface ReflectionSetter
Parameters:
field - - the field to be set
newValue - - the new value to be set
Returns:
the oldValue of the field
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0