Class ContextMenuItem

java.lang.Object
com.levigo.jadice.web.client.ui.menu.contextmenu.ContextMenuItem
Direct Known Subclasses:
ContextMenuItemCommand, ContextMenuItemSubMenu

public abstract class ContextMenuItem extends Object
Abstract class for all a menu or context menu item.
  • Field Details

    • handler

      protected ContextMenuHandler handler
    • parentWidget

      protected com.google.gwt.user.client.ui.IsWidget parentWidget
  • Constructor Details

    • ContextMenuItem

      protected ContextMenuItem(Action action)
      Constructor.
      Parameters:
      action - the Action providing the content for this context menu item
  • Method Details

    • getLabel

      public String getLabel()
      Returns the label of the item.
      Returns:
      the label
    • getKeyStrokeString

      public String getKeyStrokeString()
      Returns the key stroke string.
      Returns:
      the string
    • init

      public void init(com.google.gwt.user.client.ui.IsWidget parentWidget, ContextMenuHandler handler)
      Initializes the menu item with a parent widget and a ContextMenuHandler.
      Parameters:
      parentWidget - the parent of this item
      handler - the ContextMenuHandler
    • setSelected

      protected void setSelected(boolean selected)
    • setEnabled

      protected void setEnabled(boolean enabled)
    • setAvailable

      protected void setAvailable(boolean available)
    • setHover

      public void setHover(boolean hover)
      Sets whether the icon is hovered or not.
      Parameters:
      hover - true if the icon is hovered, false if not
    • onKeyDown

      public final void onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event, boolean isLocal)
      Fired when a KeyEvent was fired
      Parameters:
      event - the KeyDownEvent
      isLocal - true when mnemonic can fire
    • _onKeyDown

      protected void _onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event)
    • execute

      public abstract boolean execute(com.google.gwt.dom.client.Element rowElement)
      Overriden in subclasses.
      Parameters:
      rowElement - An element that can be used to dynamically place the new context menu entry.
      Returns:
      True if it was successfully executed (stop propagation, prevent default browser behavior).
    • onAttach

      public void onAttach()
      Call on attach. Executes attach actions.
    • onDetach

      public void onDetach()
      Call on detach. Executes detach actions.
    • isSubmenu

      public abstract boolean isSubmenu()
      Returns whether this item is a sub-menu or not
      Returns:
      true if it is a sub-menu, false if not
    • hide

      public void hide()