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
ConstructorsModifierConstructorDescriptionprotectedContextMenuItem(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.voidaddItemClickListener(CmsContextMenu.ContextMenuItemClickListener clickListener) Adds context menu item click listener only to this item.voidaddStyleName(String style) Add a new style to the menu item.booleanprotected Set<CmsContextMenu.ContextMenuItem> Returns the item children.getData()Returns the item data.Returns the item description.com.vaadin.server.ResourcegetIcon()Returns the icon.protected CmsContextMenu.ContextMenuItemReturns the parent item.inthashCode()booleanReturns whether the item has a separator.booleanReturns whether the item has a sub menu.booleanReturns if the item is enabled.booleanReturns whether this item is the root item.protected voidNotifies all click listeners.voidRemoves given click listener from this item.voidremoveStyleName(String style) Remove a style name from this menu item.voidsetCaption(String newCaption) Changes the caption of the menu item.voidAssociates given object with this menu item.voidsetDescription(String description) Sets the item description used as tool-tip.voidsetEnabled(boolean enabled) Enables or disables this menu item.voidsetIcon(com.vaadin.server.Resource icon) Sets given resource as icon of this menu item.voidsetSeparatorVisible(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:
trueif separator line is visible after this item
-
hasSubMenu
Returns whether the item has a sub menu.- Returns:
trueif this menu item has a sub menu
-
isEnabled
Returns if the item is enabled.- Returns:
trueif menu item is enabled
-
isRootItem
Returns whether this item is the root item.- Returns:
trueif 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.
-