Skip to main content
PREV CLASS NEXT CLASS FRAMES NO FRAMES

 

Class IlvMenuItem

IlvObject
   |
   +--IlvPanel
      |
      +--IlvMenuItem

Category:
Common component
JavaScript File:
IlvAbstractPopupMenu.js
Description:
This class implements menu items to compose a menu. It constructs a new IlvMenuItem with the specified label,isEnabled,action and image properties. properties. Note that the use of "-" in a label is reserved to indicate a separator between menu items. By default, all menu items are enabled, except separators.
See also:
IlvMenu

Constructor Summary
Constructor Attributes Constructor Name and Description
 
IlvMenuItem(label, isEnabled, action, image, path)
Method Summary
Method Attributes Method Name and Description
 
createHTMLContent(width, height)
Generates the HTML representation of this menu item.
 
Returns the action to trigger when this menu item is selected.
 
Retrieves the icon of this menu item.
 
Returns the preferred size used by the icon of this menu item.
 
Retrieves the label of this menu item.
 
Returns the parent of this menu item.
 
Returns the preferred size for this menu item.
 
Returns the root IlvMenu instance for this menu item.
 
Checks whether this menu item is enabled.
 
Checks whether this menu item is highlighted.
 
isRoot()
Returns true if this menu is of type IlvMenu and a root menu.
 
Invoked each time the user moves the mouse over this menu item.
 
Invoked each time the user clicks this menu item.
 
performServerAction(actionName, params, updateAll)
Performs a server action, using the action name and the parameters.
 
Prepares this menu item to be recycled.
 
setAction(action)

Sets the action to trigger when this menu item is selected.

 
setEnabled(isEnabled)
Specifies whether this menu item can be chosen.
 
setHighlighted(isHighlighted)
Specifies whether this menu item is highlighted.
 
setIcon(image)
Sets the icon for this menu item to the specified image URL.
 
setLabel(label)
Sets the label for this menu item to the specified label.
 
setLocation(left, top)
Sets the location of this menu item.
 
setPreferredSize(width, height)
Sets the preferred size of this menu item.
 
setSize(width, height)
Sets the size of this menu item.
 
setVisible(isVisible)
Specifies whether this menu item is visible or not.
 
update()
Updates the content of the menu item.
Methods inherited from class IlvPanel
dispose, getBounds, getClip, getCursor, getHeight, getLeft, getMouseEventSource, getScrollPosition, getTop, getWidth, getZIndex, isVisible, setBackgroundColor, setBackgroundImage, setBounds, setClip, setCursor, setScrollPosition, setZIndex, translate
Methods inherited from class IlvObject
getClassName, hashCode, instanceOf, invoke, registerDispose, registerDisposeByClientId, removeHTML, setClassName, superConstructor, superInvoke, toString, updateVisibility
Constructor Detail
IlvMenuItem
IlvMenuItem(label, isEnabled, action, image, path)
Parameters:
label
isEnabled
action
image
path
Method Detail
createHTMLContent
createHTMLContent(width, height)
Generates the HTML representation of this menu item.

This method is invoked without any parameters by the getPreferredSize method to compute the best size for this menu item.

Parameters:
width
height

getAction
getAction()
Returns the action to trigger when this menu item is selected.
Returns:
The action.

getIcon
getIcon()
Retrieves the icon of this menu item.
Returns:
The icon of this menu item.

getIconPreferredSize
getIconPreferredSize()
Returns the preferred size used by the icon of this menu item.

getLabel
getLabel()
Retrieves the label of this menu item.
Returns:
The label of this menu item.

getParent
getParent()
Returns the parent of this menu item. The parent is an instance of IlvMenu. An instance of IlvMenuItem has always a parent. However, the root instance of IlvMenu returns null.
See also:
#isRoot
#getRoot

getPreferredSize
getPreferredSize()
Returns the preferred size for this menu item.

getRoot
getRoot()
Returns the root IlvMenu instance for this menu item.
See also:
#getParent
#isRoot

isEnabled
isEnabled()
Checks whether this menu item is enabled.
Returns:
true if the menu item is enabled; false if it is disabled.

isHighlighted
isHighlighted()
Checks whether this menu item is highlighted.
Returns:
true if the menu item is highlighted; otherwise, returns false.

isRoot
isRoot()
Returns true if this menu is of type IlvMenu and a root menu. If this menu is of type IlvMenuItem, or an IlvMenu that is a submenu, this method returns false.
See also:
#getParent
#getRoot

onmouseover
onmouseover()
Invoked each time the user moves the mouse over this menu item. This method highlights this menu item.

onmouseup
onmouseup()
Invoked each time the user clicks this menu item.

This method sends the action corresponding to this menu item to the server and refreshes the view. It can be modified/overridden to handle the action locally or in a different way.


performServerAction
performServerAction(actionName, params, updateAll)
Performs a server action, using the action name and the parameters. This method will call the performServerAction of the pop-up menu attached to the root menu of this menu item.
Parameters:
actionName - The server action name
params - The additional action parameters.
updateAll - Flag to determine whether update the image only or also the capabilities (if the view is compatible).

recycle
recycle()
Prepares this menu item to be recycled. We do this because we want to reuse the created DIV/LAYER objects rather than creating hundreds of them, which would be useless as soon as the pop-up menu has disappeared.

setAction
setAction(action)

Sets the action to trigger when this menu item is selected.

The action can either be a String or a function.

In the function signature has two parameters:

Parameters:
action - The action to set.

setEnabled
setEnabled(isEnabled)
Specifies whether this menu item can be chosen.
Parameters:
isEnabled - If true, the menu item is enabled; if false, the menu item is disabled.

setHighlighted
setHighlighted(isHighlighted)
Specifies whether this menu item is highlighted.
Parameters:
isHighlighted - If true, this menu item is highlighted.

setIcon
setIcon(image)
Sets the icon for this menu item to the specified image URL.
Parameters:
image - The new icon, or null for no icon.

setLabel
setLabel(label)
Sets the label for this menu item to the specified label.
Parameters:
label - The new label, or null for no label.

setLocation
setLocation(left, top)
Sets the location of this menu item. Only the location of the root menu has to be set, the location of any other menu item is computed automatically based on the root menu location and the size of the window.
Parameters:
left - The y coordinate of the top-left corner of the menu item.
top - The x coordinate of the top-left corner of the menu item.

setPreferredSize
setPreferredSize(width, height)
Sets the preferred size of this menu item. When the size can automatically be computed this information is not taken into account.
Parameters:
width
height

setSize
setSize(width, height)
Sets the size of this menu item.
Parameters:
width - The new width of this menu item.
height - The new height of this menu item.

setVisible
setVisible(isVisible)
Specifies whether this menu item is visible or not. Only the root menu has to be made visible; the visibility of any other menu item is modified automatically by the mouse events.
Parameters:
isVisible

update
update()
Updates the content of the menu item.

©Copyright Rogue Wave Software Inc. 1997, 2018. All Rights Reserved.