Package org.opencms.ui.contextmenu
Class CmsContextMenu.ContextMenuItem
java.lang.Object
org.opencms.ui.contextmenu.CmsContextMenu.ContextMenuItem
- All Implemented Interfaces:
Serializable
- Enclosing class:
- CmsContextMenu
ContextMenuItem represents one clickable item in the context menu. Item may have sub items.
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
ContextMenuItem
(CmsContextMenu.ContextMenuItem parent, CmsContextMenuState.ContextMenuItemState itemState) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionaddItem
(com.vaadin.server.Resource icon) Adds new item as this item's sub item with given icon.Adds new item as this item's sub item with given caption.Adds new item as this item's sub item with given caption and icon.void
addItemClickListener
(CmsContextMenu.ContextMenuItemClickListener clickListener) Adds context menu item click listener only to this item.void
addStyleName
(String style) Add a new style to the menu item.boolean
protected Set<CmsContextMenu.ContextMenuItem>
Returns the item children.getData()
Returns the item data.Returns the item description.com.vaadin.server.Resource
getIcon()
Returns the icon.protected CmsContextMenu.ContextMenuItem
Returns the parent item.int
hashCode()
boolean
Returns whether the item has a separator.boolean
Returns whether the item has a sub menu.boolean
Returns if the item is enabled.boolean
Returns whether this item is the root item.protected void
Notifies all click listeners.void
Removes given click listener from this item.void
removeStyleName
(String style) Remove a style name from this menu item.void
setCaption
(String newCaption) Changes the caption of the menu item.void
Associates given object with this menu item.void
setDescription
(String description) Sets the item description used as tool-tip.void
setEnabled
(boolean enabled) Enables or disables this menu item.void
setIcon
(com.vaadin.server.Resource icon) Sets given resource as icon of this menu item.void
setSeparatorVisible
(boolean separatorVisible) Sets or disables separator line under this item.
-
Constructor Details
-
Method Details
-
addItem
Adds new item as this item's sub item with given icon.- Parameters:
icon
- the icon- Returns:
- reference to newly added item
-
addItem
Adds new item as this item's sub item with given caption.- Parameters:
caption
- the caption- Returns:
- reference to newly created item.
-
addItem
Adds new item as this item's sub item with given caption and icon.- Parameters:
caption
- the captionicon
- the icon- Returns:
- reference to newly added item
-
addStyleName
Add a new style to the menu item. This method is following the same semantics asComponent.addStyleName(String)
.- Parameters:
style
- the new style to be added to the component
-
equals
-
getData
Returns the item data.- Returns:
- Object associated with ContextMenuItem.
-
getDescription
Returns the item description.- Returns:
- the description
-
getIcon
Returns the icon.- Returns:
- current icon
-
hashCode
-
hasSeparator
Returns whether the item has a separator.- Returns:
true
if separator line is visible after this item
-
hasSubMenu
Returns whether the item has a sub menu.- Returns:
true
if this menu item has a sub menu
-
isEnabled
Returns if the item is enabled.- Returns:
true
if menu item is enabled
-
isRootItem
Returns whether this item is the root item.- Returns:
true
if this item is root item
-
removeStyleName
Remove a style name from this menu item. This method is following the same semantics asComponent.removeStyleName(String)
.- Parameters:
style
- the style name or style names to be removed
-
setCaption
Changes the caption of the menu item.- Parameters:
newCaption
- the caption
-
setData
Associates given object with this menu item. Given object can be whatever application specific if necessary.- Parameters:
data
- the data
-
setDescription
Sets the item description used as tool-tip.- Parameters:
description
- the description
-
setEnabled
Enables or disables this menu item.- Parameters:
enabled
- the enabled flag
-
setIcon
Sets given resource as icon of this menu item.- Parameters:
icon
- the icon
-
setSeparatorVisible
Sets or disables separator line under this item.- Parameters:
separatorVisible
- the visibility flag
-
getAllChildren
Returns the item children.- Returns:
- the children
-
getParent
Returns the parent item.- Returns:
- parent item of this menu item. Null if this item is a root item.
-
notifyClickListeners
Notifies all click listeners.
-