IlvMenu

IlvObject
  |
  +--IlvPanel
       |
       +--IlvMenuItem
            |
            +--IlvMenu
Category:
Common component
JavaScript File:
IlvAbstractPopupMenu.js
Description:
This class implements a menu that can be dynamically popped up at a specified position within the window of a browser.

Each item in a menu must belong to the IlvMenuItem class. It can be an instance of IlvMenuItem or a submenu (an instance of IlvMenu).


Constructor Summary
IlvMenu(label, isEnabled, image, path)

Method Summary
add(menuItem)
Adds the specified menu item to this menu.
collapse()
Collapses this menu and every child.
computeChildrenSize()
Compute and sets the size of the children using the getPreferredSize method.
getChild(index)
Returns the child at the specified index or null.
getChildren()
Returns a copy of the children array of this menu.
getChildrenCount()
Returns the number of children of this menu.
getChildrenHeight()
Returns the height of the submenu made up of all the children of this menu.
getChildrenWidth()
Returns the width of the submenu made up of all the children of this menu.
isExpanded()
Checks whether this menu is expanded (that is, if the submenu is visible).
isVisible()
Checks whether this menu is visible.
onmouseover()
Invoked each time the user moves the mouse over this menu.
recycle()
Prepares this menu to be recycled.
setExpanded(isExpanded)
Specifies whether this menu is expanded (that is, if the submenu is visible).
setHighlighted(isHighlighted)
Specifies whether this menu is highlighted.
setHighlightedChild(child)
Highlights the given child, and lowlights any other.
setLocation(left, top)
Sets the location of this menu.
setVisible(isVisible)
Specifies whether this menu is visible.

Constructor Detail

IlvMenu

IlvMenu(label, isEnabled, image, path)
Creates an instance of IlvMenu.

Method Detail

add

add(menuItem)
Adds the specified menu item to this menu.
Parameters:
menuItem - The menu item to be added.

collapse

collapse()
Collapses this menu and every child.

computeChildrenSize

computeChildrenSize()
Compute and sets the size of the children using the getPreferredSize method.

getChild

getChild(index)
Returns the child at the specified index or null.

Since:
JViews 8.0


getChildren

getChildren()
Returns a copy of the children array of this menu.

Since:
JViews 8.0


getChildrenCount

getChildrenCount()
Returns the number of children of this menu.

getChildrenHeight

getChildrenHeight()
Returns the height of the submenu made up of all the children of this menu.

getChildrenWidth

getChildrenWidth()
Returns the width of the submenu made up of all the children of this menu.

isExpanded

isExpanded()
Checks whether this menu is expanded (that is, if the submenu is visible).
Returns:
true if the menu is expanded; otherwise, it returns false.

isVisible

isVisible()
Checks whether this menu is visible.
Returns:
true if the menu item is visible; otherwise, it returns false.

onmouseover

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

recycle

recycle()
Prepares this menu 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 popup menu has disappeared.

setExpanded

setExpanded(isExpanded)
Specifies whether this menu is expanded (that is, if the submenu is visible).
Parameters:
isEnabled - If true, this menu is expanded.

setHighlighted

setHighlighted(isHighlighted)
Specifies whether this menu is highlighted. When a menu is highlighted, it is also expanded (the submenu is made visible).
Parameters:
isHighlighted - If true, this menu is highlighted.

See also:
#setExpanded


setHighlightedChild

setHighlightedChild(child)
Highlights the given child, and lowlights any other.

setLocation

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

setVisible

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

Inherited Methods from IlvMenuItem
createHTMLContent, getAction, getIcon, getIconPreferredSize, getLabel, getParent, getPreferredSize, getRoot, isEnabled, isHighlighted, isRoot, onmouseover, onmouseup, performServerAction, recycle, setAction, setEnabled, setHighlighted, setIcon, setLabel, setLocation, setPreferredSize, setSize, setVisible, update
Inherited Methods from IlvPanel
dispose, getBounds, getClip, getCursor, getHeight, getLeft, getMouseEventSource, getScrollPosition, getTop, getWidth, getZIndex, isVisible, setBackgroundColor, setBackgroundImage, setBounds, setClip, setCursor, setLocation, setScrollPosition, setSize, setVisible, setZIndex, translate
Inherited Methods from IlvObject
callDispose, dispose, getClassName, hashCode, inherits, instanceOf, invoke, registerDispose, removeHTML, setClassName, superConstructor, superInvoke, toString, updateVisibility