Class CmsContextMenu.ContextMenuItem

java.lang.Object
org.opencms.ui.contextmenu.CmsContextMenu.ContextMenuItem
All Implemented Interfaces:
Serializable
Enclosing class:
CmsContextMenu

public class CmsContextMenu.ContextMenuItem extends Object implements Serializable
ContextMenuItem represents one clickable item in the context menu. Item may have sub items.

See Also:
  • Constructor Details

  • Method Details

    • addItem

      public CmsContextMenu.ContextMenuItem addItem(com.vaadin.server.Resource icon)
      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

      public CmsContextMenu.ContextMenuItem addItem(String caption, com.vaadin.server.Resource icon)
      Adds new item as this item's sub item with given caption and icon.

      Parameters:
      caption - the caption
      icon - the icon
      Returns:
      reference to newly added item
    • addItemClickListener

      Adds context menu item click listener only to this item. This listener will be invoked only when this item is clicked.

      Parameters:
      clickListener - the click listener
    • addStyleName

      public void addStyleName(String style)
      Add a new style to the menu item. This method is following the same semantics as Component.addStyleName(String).

      Parameters:
      style - the new style to be added to the component
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
      See Also:
    • getData

      public Object getData()
      Returns the item data.

      Returns:
      Object associated with ContextMenuItem.
    • getDescription

      Returns the item description.

      Returns:
      the description
    • getIcon

      public com.vaadin.server.Resource getIcon()
      Returns the icon.

      Returns:
      current icon
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • hasSeparator

      public boolean hasSeparator()
      Returns whether the item has a separator.

      Returns:
      true if separator line is visible after this item
    • hasSubMenu

      public boolean hasSubMenu()
      Returns whether the item has a sub menu.

      Returns:
      true if this menu item has a sub menu
    • isEnabled

      public boolean isEnabled()
      Returns if the item is enabled.

      Returns:
      true if menu item is enabled
    • isRootItem

      public boolean isRootItem()
      Returns whether this item is the root item.

      Returns:
      true if this item is root item
    • removeItemClickListener

      Removes given click listener from this item. Removing listener affects only this context menu item.

      Parameters:
      clickListener - the click listener to remove
    • removeStyleName

      public void removeStyleName(String style)
      Remove a style name from this menu item. This method is following the same semantics as Component.removeStyleName(String).

      Parameters:
      style - the style name or style names to be removed
    • setCaption

      public void setCaption(String newCaption)
      Changes the caption of the menu item.

      Parameters:
      newCaption - the caption
    • setData

      public void setData(Object data)
      Associates given object with this menu item. Given object can be whatever application specific if necessary.

      Parameters:
      data - the data
    • setDescription

      public void setDescription(String description)
      Sets the item description used as tool-tip.

      Parameters:
      description - the description
    • setEnabled

      public void setEnabled(boolean enabled)
      Enables or disables this menu item.

      Parameters:
      enabled - the enabled flag
    • setIcon

      public void setIcon(com.vaadin.server.Resource icon)
      Sets given resource as icon of this menu item.

      Parameters:
      icon - the icon
    • setSeparatorVisible

      public void setSeparatorVisible(boolean separatorVisible)
      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

      protected void notifyClickListeners()
      Notifies all click listeners.