Class CmsContextMenu.ContextMenuItem

  • All Implemented Interfaces:
    java.io.Serializable
    Enclosing class:
    CmsContextMenu

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

    See Also:
    Serialized Form
    • Method Detail

      • 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

        public CmsContextMenu.ContextMenuItem addItem​(java.lang.String caption)
        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​(java.lang.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
      • addStyleName

        public void addStyleName​(java.lang.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​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • getData

        public java.lang.Object getData()
        Returns the item data.

        Returns:
        Object associated with ContextMenuItem.
      • getDescription

        public java.lang.String 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 java.lang.Object
        See Also:
        Object.hashCode()
      • 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
      • removeStyleName

        public void removeStyleName​(java.lang.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​(java.lang.String newCaption)
        Changes the caption of the menu item.

        Parameters:
        newCaption - the caption
      • setData

        public void setData​(java.lang.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​(java.lang.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