JSMenu
Last updated
Was this helpful?
Last updated
Was this helpful?
JSMenu
is a wrapper for scripting menu objects, providing properties and methods to define and manage menus in a user interface.
The name property serves as the identifier for a menu, allowing for easy reference during scripting. The styleClass property enables the assignment of space-separated CSS style classes to customize the menu's appearance.
JSMenu offers a range of methods to interact with menu items. The addMenuItem(id)
and addMenuItem(id, index)
methods allow adding menu items either at the end of the list or at a specific position. Existing menu items can be retrieved using methods like findMenuItem(id)
, which searches for items by identifier, including nested ones, and getMenuItem(id)
or getMenuItemAt(index)
, which retrieve menu items based on identifier or index respectively. The getMenuItems()
method returns a list of all menu items in the order they appear in the interface.
Additional functionality includes removing menu items using removeMenuItem(menuItem)
or removeMenuItem(id)
, both of which return a Boolean indicating success. The selectMenuItem(menuItem)
method allows selecting a specific menu item in the user interface. For enhanced security considerations, the getMenuItemsWithSecurity()
method provides items with security metadata, and the getSelectedItem()
method retrieves the currently selected item.
For further information, refer to the section of this documentation.
The menu name (identifier)
Set/Get the menu space separated styleclases
Adds a new menu item, as last item in the list.
Adds a new menu item, at a specific position.
Gets a menu item by identifier.
Gets a menu item by identifier.
Gets a menu item by index (0 based).
Returns all the menus items, either created at design time or at runtime, in the order they will show up in user interface.
Removes a menu item from children's list, returns true if element was found an removed
Removes a menu item with given id, returns true if element was found an removed
void
Selects a menu item in user interface
The menu name (identifier)
Set/Get the menu space separated styleclases
Sample
Adds a new menu item, as last item in the list.
Parameters
Sample
Adds a new menu item, at a specific position.
Parameters
Sample
Gets a menu item by identifier. Also searches for nested elements. Returns null if not found.
Parameters
Sample
Gets a menu item by identifier. Returns null if not found.
Parameters
Sample
Gets a menu item by index (0 based). Returns null if not found.
Parameters
Sample
Returns all the menus items, either created at design time or at runtime, in the order they will show up in user interface.
Sample
Removes a menu item from children's list, returns true if element was found an removed
Parameters
Sample
Removes a menu item with given id, returns true if element was found an removed
Parameters
Sample
Selects a menu item in user interface
Parameters
Returns: void
Sample
Type the name (identifier) of the menu
Type The space-separated style classes applied to the menu.
id the menu item identifier
Returns: The newly added menu item.
id the menu item identifier
index the index position in list (0 based)
Returns: The newly added menu item at the specified index.
id the menu item identifier
Returns: The menu item with the specified identifier, including nested items, or null if not found.
id the menu item identifier
Returns: The menu item with the specified identifier, or null if not found.
index the menu item index among its sibblings
Returns: The menu item at the specified index, or null if the index is out of bounds.
Returns: An array of all menu items in this menu, in the order they appear in the user interface.
Returns: An array of menu items that have the security flag set to "viewable."
Returns: the selectedItem
menuItem the menu item to be removed
Returns: True if the specified menu item was removed; false otherwise.
id the menu item identifier
Returns: True if a menu item with the specified identifier was removed; false otherwise.
menuItem the menu item to be selected