EchoPoint
1.0

echopoint
Class Menu

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

public class Menu
extends MenuItem

The Menu 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 Menu.NestedStyleInfo
          Nested public static StyleInfo class.
 
Field Summary
static java.lang.String LEFT_OFFSET_CHANGED_PROPERTY
           
protected  int leftOffset
           
protected  int margin
           
static java.lang.String MARGIN_CHANGED_PROPERTY
           
static java.lang.String MENU_BORDER_COLOR_CHANGED_PROPERTY
           
static java.lang.String MENU_BORDER_SIZE_CHANGED_PROPERTY
           
protected  nextapp.echo.Color menuBorderColor
           
protected  int menuBorderSize
           
protected  int padding
           
static java.lang.String PADDING_CHANGED_PROPERTY
           
static java.lang.String STYLE_LEFT_OFFSET
          A style constant for the Left Offset property.
static java.lang.String STYLE_MARGIN
          A style constant for the Margin property.
static java.lang.String STYLE_MENU_BORDER_COLOR
          A style constant for the Menu Border Color property.
static java.lang.String STYLE_MENU_BORDER_SIZE
          A style constant for the Menu Border Size property.
static java.lang.String STYLE_PADDING
          A style constant for the Padding property.
static java.lang.String STYLE_ROLLOVER_SUBMENU_IMAGE
          A style constant for the Submenu Image property.
static java.lang.String STYLE_ROLLOVER_SUBMENU_IMAGE_ALIGNMENT
          A style constant for the Submenu Image Alignment property.
static java.lang.String STYLE_TOP_OFFSET
          A style constant for the Top Offset property.
static java.lang.String STYLE_WIDTH
          A style constant for the Width property.
static java.lang.String SUBMENU_IMAGE_ALIGNMENT_CHANGED_PROPERTY
           
static java.lang.String SUBMENU_IMAGE_CHANGED_PROPERTY
          Property Changes Names
protected  nextapp.echo.ImageReference submenuImage
           
protected  int submenuImageAlignment
           
static java.lang.String TOP_OFFSET_CHANGED_PROPERTY
           
protected  int topOffset
           
protected  int width
           
static java.lang.String WIDTH_CHANGED_PROPERTY
           
 
Fields inherited from class echopoint.MenuItem
BORDER_COLOR_CHANGED_PROPERTY, borderColor, rolloverColor, STYLE_BORDER_COLOR, STYLE_ROLLOVER_BORDER_COLOR, 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
Menu()
          Creates a button with no text or icon.
Menu(nextapp.echo.ImageReference icon)
          Creates a button with an icon.
Menu(java.lang.String text)
          Creates a button with text.
Menu(java.lang.String text, nextapp.echo.ImageReference icon)
          Creates a button with text and an icon.
 
Method Summary
 void add(nextapp.echo.Component c)
          Adds a Component to the end of the Menu.
 MenuItem add(MenuItem menuItem)
          Adds a MenuItem to the end of the Menu.
 MenuItem add(java.lang.String text)
          Adds a MenuItem to the end of the Menu with the specified text.
protected  void addToHierarchy(nextapp.echo.Component c)
          Adds a Component to the echo hierarchy.
 void applyStyle(nextapp.echo.Style style)
          Applies the provided style to the component.
 int getLeftOffset()
          Returns the left offset of this Menu Note: Thjis only takes effect when the Menu is a direct child of the MenuBar, ie a first level child.
 int getMargin()
          Gets the margin of the Menu on the screen.
 nextapp.echo.Color getMenuBorderColor()
           
 int getMenuBorderSize()
           
 int getPadding()
          Gets the padding of the Menu on the screen.
 nextapp.echo.ImageReference getSubmenuImage()
           
 int getSubmenuImageAlignment()
           
 int getTopOffset()
          Returns the top offset of this Menu Note: This only takes effect when the Menu is a direct child of the MenuBar, ie a first level child.
 int getWidth()
          Sets the width of the Menu on the screen.
 void remove(nextapp.echo.Component c)
          Removes a Component from the Menu.
 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 setLeftOffset(int newLeftOffset)
          Sets the left offset of this Menu Note: Thjis only takes effect when the Menu is a direct child of the MenuBar, ie a first level child.
 void setMargin(int newValue)
          Sets the margin of the Menu on the screen.
 void setMenuBorderColor(nextapp.echo.Color newBorderColor)
          Sets the Color of the Menu's border.
 void setMenuBorderSize(int newBorderSize)
          Sets the size of the Menu outer border.
 void setPadding(int newValue)
          Sets the padding of the Menu on the screen.
 void setSubmenuImage(nextapp.echo.ImageReference newImageRef)
          Sets the submenu ImageReference of the Menu.
 void setSubmenuImageAlignment(int newAlignment)
          Sets the submenu alignment of the Menu.
 void setTopOffset(int newTopOffset)
          Sets the top offset of this Menu Note: Thjis only takes effect when the Menu is a direct child of the MenuBar, ie a first level child.
 void setWidth(int newValue)
          Sets the width of the Menu on the screen.
 java.lang.String toString()
           
 
Methods inherited from class echopoint.MenuItem
getBorderColor, getId, getRolloverBorderColor, setBorderColor, setRolloverBorderColor
 
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, 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, 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_ROLLOVER_SUBMENU_IMAGE

public static final java.lang.String STYLE_ROLLOVER_SUBMENU_IMAGE
A style constant for the Submenu Image property. Values of this key must be of type nextapp.echo.ImageReference.

See Also:
Constant Field Values

STYLE_ROLLOVER_SUBMENU_IMAGE_ALIGNMENT

public static final java.lang.String STYLE_ROLLOVER_SUBMENU_IMAGE_ALIGNMENT
A style constant for the Submenu Image Alignment property. Values of this key must be of type int

See Also:
Constant Field Values

STYLE_WIDTH

public static final java.lang.String STYLE_WIDTH
A style constant for the Width property. Values of this key must be of type int

See Also:
Constant Field Values

STYLE_MARGIN

public static final java.lang.String STYLE_MARGIN
A style constant for the Margin property. Values of this key must be of type int

See Also:
Constant Field Values

STYLE_PADDING

public static final java.lang.String STYLE_PADDING
A style constant for the Padding property. Values of this key must be of type int

See Also:
Constant Field Values

STYLE_MENU_BORDER_COLOR

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

See Also:
Constant Field Values

STYLE_MENU_BORDER_SIZE

public static final java.lang.String STYLE_MENU_BORDER_SIZE
A style constant for the Menu Border Size property. Values of this key must be of type Integer.

See Also:
Constant Field Values

STYLE_TOP_OFFSET

public static final java.lang.String STYLE_TOP_OFFSET
A style constant for the Top Offset property. Values of this key must be of type int

See Also:
Constant Field Values

STYLE_LEFT_OFFSET

public static final java.lang.String STYLE_LEFT_OFFSET
A style constant for the Left Offset property. Values of this key must be of type int

See Also:
Constant Field Values

SUBMENU_IMAGE_CHANGED_PROPERTY

public static final java.lang.String SUBMENU_IMAGE_CHANGED_PROPERTY
Property Changes Names

See Also:
Constant Field Values

SUBMENU_IMAGE_ALIGNMENT_CHANGED_PROPERTY

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

WIDTH_CHANGED_PROPERTY

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

MARGIN_CHANGED_PROPERTY

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

PADDING_CHANGED_PROPERTY

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

MENU_BORDER_COLOR_CHANGED_PROPERTY

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

MENU_BORDER_SIZE_CHANGED_PROPERTY

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

TOP_OFFSET_CHANGED_PROPERTY

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

LEFT_OFFSET_CHANGED_PROPERTY

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

submenuImage

protected nextapp.echo.ImageReference submenuImage

submenuImageAlignment

protected int submenuImageAlignment

width

protected int width

margin

protected int margin

padding

protected int padding

menuBorderColor

protected nextapp.echo.Color menuBorderColor

menuBorderSize

protected int menuBorderSize

topOffset

protected int topOffset

leftOffset

protected int leftOffset
Constructor Detail

Menu

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


Menu

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

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

Menu

public Menu(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.

Menu

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

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

add

public MenuItem add(MenuItem menuItem)
Adds a MenuItem to the end of the Menu.


add

public MenuItem add(java.lang.String text)
Adds a MenuItem to the end of the Menu with the specified text.


add

public void add(nextapp.echo.Component c)
Adds a Component to the end of the Menu. This could typically by a Separator.


addToHierarchy

protected void addToHierarchy(nextapp.echo.Component c)
Adds a Component to the echo hierarchy. This can be used to avoid unintentional super.add() calls.


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.

Overrides:
applyStyle in class MenuItem

getLeftOffset

public int getLeftOffset()
Returns the left offset of this Menu

Note: Thjis only takes effect when the Menu is a direct child of the MenuBar, ie a first level child.

Returns:
int

getMargin

public int getMargin()
Gets the margin of the Menu on the screen.
If this value is -1, then the Menu will have no margins


getMenuBorderColor

public nextapp.echo.Color getMenuBorderColor()
Returns:
The Color of the Menu's border.

getMenuBorderSize

public int getMenuBorderSize()
Returns:
The size of the Menu's outer border.

getPadding

public int getPadding()
Gets the padding of the Menu on the screen.
If this value is < 0, then the Menu will have no padding


getSubmenuImage

public nextapp.echo.ImageReference getSubmenuImage()
Returns:
The submenu Image Reference of the Menu.

getSubmenuImageAlignment

public int getSubmenuImageAlignment()
Returns:
The submenu image alignmentof the Menu.

getTopOffset

public int getTopOffset()
Returns the top offset of this Menu

Note: This only takes effect when the Menu is a direct child of the MenuBar, ie a first level child.

Returns:
int

getWidth

public int getWidth()
Sets the width of the Menu on the screen.
This only affects menus that are not in a fixed position.
If this value is -1, then the Menu will be as wide as required.


remove

public void remove(nextapp.echo.Component c)
Removes a Component from the Menu.


setLeftOffset

public void setLeftOffset(int newLeftOffset)
Sets the left offset of this Menu

Note: Thjis only takes effect when the Menu is a direct child of the MenuBar, ie a first level child.

Parameters:
newLeftOffset - int

setMargin

public void setMargin(int newValue)
Sets the margin of the Menu on the screen.
If this value is -1, then the Menu will have no margin
This methods fires a PropertyChangeEvent with a getPropertyName() value of Menu.MARGIN_CHANGED_PROPERTY


setMenuBorderColor

public void setMenuBorderColor(nextapp.echo.Color newBorderColor)
Sets the Color of the Menu's border.
This methods fires a PropertyChangeEvent with a getPropertyName() value of MenuItem.MENU_BORDER_COLOR_CHANGED_PROPERTY


setMenuBorderSize

public void setMenuBorderSize(int newBorderSize)
Sets the size of the Menu outer border.
This methods fires a PropertyChangeEvent with a getPropertyName() value of Menu.BORDER_SIZE_CHANGED_PROPERTY


setPadding

public void setPadding(int newValue)
Sets the padding of the Menu on the screen.
If this value is -1, then the Menu will have no padding
This methods fires a PropertyChangeEvent with a getPropertyName() value of Menu.PADDING_CHANGED_PROPERTY


setSubmenuImage

public void setSubmenuImage(nextapp.echo.ImageReference newImageRef)
Sets the submenu ImageReference of the Menu.
This methods fires a PropertyChangeEvent with a getPropertyName() value of Menu.SUBMENU_IMAGE_CHANGED_PROPERTY


setSubmenuImageAlignment

public void setSubmenuImageAlignment(int newAlignment)
Sets the submenu alignment of the Menu.
This can be one of the following values :
  • EchoConstants.TOP
  • EchoConstants.BOTTOM
  • EchoConstants.LEFT
  • EchoConstants.RIGHT (the default)

This methods fires a PropertyChangeEvent with a getPropertyName() value of Menu.SUBMENU_IMAGE_ALIGNMENT_CHANGED_PROPERTY


setTopOffset

public void setTopOffset(int newTopOffset)
Sets the top offset of this Menu

Note: Thjis only takes effect when the Menu is a direct child of the MenuBar, ie a first level child.

Parameters:
newTopOffset - int

setWidth

public void setWidth(int newValue)
Sets the width of the Menu on the screen.
This only affects menus that are not in a fixed position.
If this value is -1, then the Menu will be as wide as required.
This methods fires a PropertyChangeEvent with a getPropertyName() value of Menu.WIDTH_CHANGED_PROPERTY


toString

public java.lang.String toString()
Overrides:
toString in class MenuItem
See Also:
Object.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
Overrides:
set in class MenuItem
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0