NextApp Echo3 Extras
v3.0.b4

nextapp.echo.extras.app
Class ContextMenu

java.lang.Object
  extended by nextapp.echo.app.Component
      extended by nextapp.echo.extras.app.menu.AbstractMenuComponent
          extended by nextapp.echo.extras.app.ContextMenu
All Implemented Interfaces:
java.io.Serializable, nextapp.echo.app.RenderIdSupport

public class ContextMenu
extends AbstractMenuComponent

A component that shows a menu when right-clicked, i.e. a context menu. This component supports at most one child which, when present, will be used as visible content. The component itself will not be visible.

Author:
n.beekman
See Also:
Serialized Form

Field Summary
static int ACTIVATION_MODE_CLICK
           
static int ACTIVATION_MODE_CONTEXT_CLICK
           
static java.lang.String PROPERTY_ACTIVATION_MODE
           
static java.lang.String PROPERTY_BACKGROUND_IMAGE
           
static java.lang.String PROPERTY_BORDER
           
static java.lang.String PROPERTY_DISABLED_BACKGROUND
           
static java.lang.String PROPERTY_DISABLED_BACKGROUND_IMAGE
           
static java.lang.String PROPERTY_DISABLED_FOREGROUND
           
static java.lang.String PROPERTY_MENU_EXPAND_ICON
           
static java.lang.String PROPERTY_SELECTION_BACKGROUND
           
static java.lang.String PROPERTY_SELECTION_BACKGROUND_IMAGE
           
static java.lang.String PROPERTY_SELECTION_FOREGROUND
           
 
Fields inherited from class nextapp.echo.extras.app.menu.AbstractMenuComponent
ACTION_LISTENERS_CHANGED_PROPERTY, DEFAULT_ANIMATION_TIME, INPUT_ACTION, MODEL_CHANGED_PROPERTY, PROPERTY_ANIMATION_TIME, STATE_MODEL_CHANGED_PROPERTY
 
Fields inherited from class nextapp.echo.app.Component
CHILD_VISIBLE_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
ContextMenu()
          Creates a new ContextMenu with an empty DefaultMenuModel as its model and a DefaultMenuStateModel to provide state information.
ContextMenu(nextapp.echo.app.Component applyTo)
          Creates a new ContextMenu with an empty DefaultMenuModel as its model and a DefaultMenuStateModel to provide state information.
ContextMenu(nextapp.echo.app.Component applyTo, MenuModel model)
          Creates a new ContextMenu displaying the specified MenuModel and using a DefaultMenuStateModel to provide state information.
ContextMenu(nextapp.echo.app.Component applyTo, MenuModel model, MenuStateModel stateModel)
          Creates a new ContextMenu displaying the specified MenuModel and using the specified MenuStateModel to provide state information.
 
Method Summary
 int getActivationMode()
          Returns the activation mode of the context menu.
 nextapp.echo.app.Component getApplyTo()
           
 nextapp.echo.app.FillImage getBackgroundImage()
          Returns the background image that will be displayed in pull-down menus.
 nextapp.echo.app.Border getBorder()
          Returns the border that will be displayed around pull-down menus.
 nextapp.echo.app.Color getDisabledBackground()
          Returns the background color used to render disabled menu items.
 nextapp.echo.app.FillImage getDisabledBackgroundImage()
          Returns the background image used to render disabled menu items.
 nextapp.echo.app.Color getDisabledForeground()
          Returns the foreground color used to render disabled menu items.
 nextapp.echo.app.ImageReference getMenuExpandIcon()
          Returns the icon used to expand pull-down menus.
 nextapp.echo.app.Color getSelectionBackground()
          Returns the background color used to highlight the currently selected menu item.
 nextapp.echo.app.FillImage getSelectionBackgroundImage()
          Returns the background image used to highlight the currently selected menu item.
 nextapp.echo.app.Color getSelectionForeground()
          Returns the foreground color used to highlight the currently selected menu item.
 boolean isValidChild(nextapp.echo.app.Component child)
           
 void setActivationMode(int newValue)
          Sets the activation mode of the context menu.
 void setApplyTo(nextapp.echo.app.Component applyTo)
          Sets the component to apply the context menu to.
 void setBackgroundImage(nextapp.echo.app.FillImage newValue)
          Sets the background image that will be displayed in pull-down menus.
 void setBorder(nextapp.echo.app.Border newValue)
          Sets the border that will be displayed around pull-down menus.
 void setDisabledBackground(nextapp.echo.app.Color newValue)
          Sets the background color used to render disabled menu items.
 void setDisabledBackgroundImage(nextapp.echo.app.FillImage newValue)
          Sets the background image used to render disabled menu items.
 void setDisabledForeground(nextapp.echo.app.Color newValue)
          Sets the foreground color used to render disabled menu items.
 void setMenuExpandIcon(nextapp.echo.app.ImageReference newValue)
          Sets the icon used to expand pull-down menus.
 void setSelectionBackground(nextapp.echo.app.Color newValue)
          Sets the background color used to highlight the currently selected menu item.
 void setSelectionBackgroundImage(nextapp.echo.app.FillImage newValue)
          Sets the background image used to highlight the currently selected menu item.
 void setSelectionForeground(nextapp.echo.app.Color newValue)
          Sets the foreground color used to highlight the currently selected menu item.
 
Methods inherited from class nextapp.echo.extras.app.menu.AbstractMenuComponent
addActionListener, doAction, fireActionPerformed, getAnimationTime, getModel, getStateModel, hasActionListeners, processInput, removeActionListener, setAnimationTime, setModel, setStateModel
 
Methods inherited from class nextapp.echo.app.Component
add, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, get, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndex, getLayoutData, getLayoutDirection, getLocale, getLocalStyle, getParent, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidParent, isVisible, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, set, setBackground, setComponents, setEnabled, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndex, setLayoutData, setLayoutDirection, setLocale, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTIVATION_MODE_CLICK

public static final int ACTIVATION_MODE_CLICK
See Also:
Constant Field Values

ACTIVATION_MODE_CONTEXT_CLICK

public static final int ACTIVATION_MODE_CONTEXT_CLICK
See Also:
Constant Field Values

PROPERTY_ACTIVATION_MODE

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

PROPERTY_BACKGROUND_IMAGE

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

PROPERTY_BORDER

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

PROPERTY_DISABLED_BACKGROUND

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

PROPERTY_DISABLED_BACKGROUND_IMAGE

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

PROPERTY_DISABLED_FOREGROUND

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

PROPERTY_MENU_EXPAND_ICON

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

PROPERTY_SELECTION_BACKGROUND

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

PROPERTY_SELECTION_BACKGROUND_IMAGE

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

PROPERTY_SELECTION_FOREGROUND

public static final java.lang.String PROPERTY_SELECTION_FOREGROUND
See Also:
Constant Field Values
Constructor Detail

ContextMenu

public ContextMenu()
Creates a new ContextMenu with an empty DefaultMenuModel as its model and a DefaultMenuStateModel to provide state information.


ContextMenu

public ContextMenu(nextapp.echo.app.Component applyTo)
Creates a new ContextMenu with an empty DefaultMenuModel as its model and a DefaultMenuStateModel to provide state information.

Parameters:
applyTo - the component to apply the context menu to

ContextMenu

public ContextMenu(nextapp.echo.app.Component applyTo,
                   MenuModel model)
Creates a new ContextMenu displaying the specified MenuModel and using a DefaultMenuStateModel to provide state information.

Parameters:
applyTo - the component to apply the context menu to
model - the model

ContextMenu

public ContextMenu(nextapp.echo.app.Component applyTo,
                   MenuModel model,
                   MenuStateModel stateModel)
Creates a new ContextMenu displaying the specified MenuModel and using the specified MenuStateModel to provide state information.

Parameters:
applyTo - the component to apply the context menu to
model - the model
stateModel - the selection model
Method Detail

getActivationMode

public int getActivationMode()
Returns the activation mode of the context menu.

Returns:
the activation mode of the context menu, one of the following values:
  • ACTIVATION_MODE_CONTEXT_CLICK
  • - context menu activates on context click (the default)
  • ACTIVATION_MODE_CLICK
  • - context menu activates on primary click

getApplyTo

public nextapp.echo.app.Component getApplyTo()
Returns:
the Component which the context menu is being applied to.

getBackgroundImage

public nextapp.echo.app.FillImage getBackgroundImage()
Returns the background image that will be displayed in pull-down menus.

Returns:
the default background image

getBorder

public nextapp.echo.app.Border getBorder()
Returns the border that will be displayed around pull-down menus.

Returns:
the default border

getDisabledBackground

public nextapp.echo.app.Color getDisabledBackground()
Returns the background color used to render disabled menu items.

Returns:
the disabled background

getDisabledBackgroundImage

public nextapp.echo.app.FillImage getDisabledBackgroundImage()
Returns the background image used to render disabled menu items.

Returns:
the disabled background image

getDisabledForeground

public nextapp.echo.app.Color getDisabledForeground()
Returns the foreground color used to render disabled menu items.

Returns:
the disabled foreground

getMenuExpandIcon

public nextapp.echo.app.ImageReference getMenuExpandIcon()
Returns the icon used to expand pull-down menus.

Returns:
the menu expand icon

getSelectionBackground

public nextapp.echo.app.Color getSelectionBackground()
Returns the background color used to highlight the currently selected menu item.

Returns:
the selection background

getSelectionBackgroundImage

public nextapp.echo.app.FillImage getSelectionBackgroundImage()
Returns the background image used to highlight the currently selected menu item.

Returns:
the selection background image

getSelectionForeground

public nextapp.echo.app.Color getSelectionForeground()
Returns the foreground color used to highlight the currently selected menu item.

Returns:
the selection foreground

setApplyTo

public void setApplyTo(nextapp.echo.app.Component applyTo)
Sets the component to apply the context menu to.

Parameters:
applyTo - the Component

setActivationMode

public void setActivationMode(int newValue)
Sets the activation mode of the context menu.

Parameters:
newValue - the new activation mode of the context menu, one of the following values:
  • ACTIVATION_MODE_CONTEXT_CLICK
  • - context menu activates on context click (the default)
  • ACTIVATION_MODE_CLICK
  • - context menu activates on primary click

setBackgroundImage

public void setBackgroundImage(nextapp.echo.app.FillImage newValue)
Sets the background image that will be displayed in pull-down menus.

Parameters:
newValue - the new background image

setBorder

public void setBorder(nextapp.echo.app.Border newValue)
Sets the border that will be displayed around pull-down menus.

Parameters:
newValue - the new default border

setDisabledBackground

public void setDisabledBackground(nextapp.echo.app.Color newValue)
Sets the background color used to render disabled menu items.

Parameters:
newValue - the new disabled background

setDisabledBackgroundImage

public void setDisabledBackgroundImage(nextapp.echo.app.FillImage newValue)
Sets the background image used to render disabled menu items.

Parameters:
newValue - the new disabled background image

setDisabledForeground

public void setDisabledForeground(nextapp.echo.app.Color newValue)
Sets the foreground color used to render disabled menu items.

Parameters:
newValue - the new disabled foreground

setMenuExpandIcon

public void setMenuExpandIcon(nextapp.echo.app.ImageReference newValue)
Sets the icon used to expand pull-down menus.

Parameters:
newValue - the new menu expand icon

setSelectionBackground

public void setSelectionBackground(nextapp.echo.app.Color newValue)
Sets the background color used to highlight the currently selected menu item.

Parameters:
newValue - the new selection background

setSelectionBackgroundImage

public void setSelectionBackgroundImage(nextapp.echo.app.FillImage newValue)
Sets the background image used to highlight the currently selected menu item.

Parameters:
newValue - the new selection background image

setSelectionForeground

public void setSelectionForeground(nextapp.echo.app.Color newValue)
Sets the foreground color used to highlight the currently selected menu item.

Parameters:
newValue - the new selection foreground

isValidChild

public boolean isValidChild(nextapp.echo.app.Component child)
Overrides:
isValidChild in class nextapp.echo.app.Component
See Also:
Component.isValidChild(Component)

NextApp Echo3 Extras
v3.0.b4