Class A_CmsContextMenuItem

  • All Implemented Interfaces:
    com.google.gwt.event.dom.client.ClickHandler, com.google.gwt.event.dom.client.HasClickHandlers, com.google.gwt.event.dom.client.HasMouseOutHandlers, com.google.gwt.event.dom.client.HasMouseOverHandlers, com.google.gwt.event.dom.client.MouseOutHandler, com.google.gwt.event.dom.client.MouseOverHandler, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.EventHandler, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget
    Direct Known Subclasses:
    CmsContextMenuItem, CmsReplace

    public abstract class A_CmsContextMenuItem
    extends com.google.gwt.user.client.ui.Composite
    implements com.google.gwt.event.dom.client.ClickHandler, com.google.gwt.event.dom.client.MouseOutHandler, com.google.gwt.event.dom.client.MouseOverHandler, com.google.gwt.event.dom.client.HasClickHandlers, com.google.gwt.event.dom.client.HasMouseOutHandlers, com.google.gwt.event.dom.client.HasMouseOverHandlers
    A abstract implementation for a context menu item.

    Since:
    version 8.0.0
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

        com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
    • Field Summary

      • Fields inherited from class com.google.gwt.user.client.ui.UIObject

        DEBUG_ID_PREFIX
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected A_CmsContextMenuItem​(java.lang.String text)
      Constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.gwt.event.shared.HandlerRegistration addClickHandler​(com.google.gwt.event.dom.client.ClickHandler handler)  
      com.google.gwt.event.shared.HandlerRegistration addMouseOutHandler​(com.google.gwt.event.dom.client.MouseOutHandler handler)  
      com.google.gwt.event.shared.HandlerRegistration addMouseOverHandler​(com.google.gwt.event.dom.client.MouseOverHandler handler)  
      void deselectItem()
      Deselects an item.
      CmsContextMenu getParentMenu()
      Returns the parent menu of this menu item.
      CmsContextMenu getSubMenu()
      Returns the sub menu of this menu item.
      java.lang.String getText()
      Returns the text of this menu item.
      boolean hasSubmenu()
      Returns true if this menu item has a sub menu, false otherwise.
      protected void initWidget​(com.google.gwt.user.client.ui.Widget widget)  
      boolean isActive()
      Returns true if the item is active false otherwise.
      abstract void onClick​(com.google.gwt.event.dom.client.ClickEvent event)
      The action that is executed on click depends on the concrete implementation of a menu item.
      protected void onHoverIn​(com.google.gwt.event.dom.client.MouseOverEvent event)
      Implements the hover over action for a item.
      protected void onHoverOut​(com.google.gwt.event.dom.client.MouseOutEvent event)
      Implements the hover out action for a item.
      void onMouseOut​(com.google.gwt.event.dom.client.MouseOutEvent event)  
      void onMouseOver​(com.google.gwt.event.dom.client.MouseOverEvent event)  
      void selectItem()
      Selects a item.
      void setActive​(boolean active, java.lang.String reason)
      Makes the menu item active or inactive.
      protected void setParentMenu​(CmsContextMenu parentMenu)
      Sets the parent menu of this menu item.
      protected void setSubMenu​(CmsContextMenu subMenu)
      Sets the sub menu for the menu item.
      void setText​(java.lang.String text)
      Sets the text of the menu item.
      • Methods inherited from class com.google.gwt.user.client.ui.Composite

        claimElement, getWidget, initializeClaimedElement, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
      • Methods inherited from class com.google.gwt.user.client.ui.Widget

        addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
      • Methods inherited from class com.google.gwt.user.client.ui.UIObject

        addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface com.google.gwt.event.shared.HasHandlers

        fireEvent
    • Constructor Detail

      • A_CmsContextMenuItem

        protected A_CmsContextMenuItem​(java.lang.String text)
        Constructor.

        Parameters:
        text - the text for the menu item
    • Method Detail

      • addClickHandler

        public com.google.gwt.event.shared.HandlerRegistration addClickHandler​(com.google.gwt.event.dom.client.ClickHandler handler)
        Specified by:
        addClickHandler in interface com.google.gwt.event.dom.client.HasClickHandlers
        See Also:
        HasClickHandlers.addClickHandler(com.google.gwt.event.dom.client.ClickHandler)
      • addMouseOutHandler

        public com.google.gwt.event.shared.HandlerRegistration addMouseOutHandler​(com.google.gwt.event.dom.client.MouseOutHandler handler)
        Specified by:
        addMouseOutHandler in interface com.google.gwt.event.dom.client.HasMouseOutHandlers
        See Also:
        HasMouseOutHandlers.addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler)
      • addMouseOverHandler

        public com.google.gwt.event.shared.HandlerRegistration addMouseOverHandler​(com.google.gwt.event.dom.client.MouseOverHandler handler)
        Specified by:
        addMouseOverHandler in interface com.google.gwt.event.dom.client.HasMouseOverHandlers
        See Also:
        HasMouseOverHandlers.addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)
      • deselectItem

        public void deselectItem()
        Deselects an item.

      • getText

        public java.lang.String getText()
        Returns the text of this menu item.

        Returns:
        the text
      • hasSubmenu

        public boolean hasSubmenu()
        Returns true if this menu item has a sub menu, false otherwise.

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

        public boolean isActive()
        Returns true if the item is active false otherwise.

        Returns:
        true if the item is active false otherwise
      • onClick

        public abstract void onClick​(com.google.gwt.event.dom.client.ClickEvent event)
        The action that is executed on click depends on the concrete implementation of a menu item. So the onClick Method has to be implemented in the sub class.

        Specified by:
        onClick in interface com.google.gwt.event.dom.client.ClickHandler
        See Also:
        ClickHandler.onClick(com.google.gwt.event.dom.client.ClickEvent)
      • onMouseOut

        public final void onMouseOut​(com.google.gwt.event.dom.client.MouseOutEvent event)
        Specified by:
        onMouseOut in interface com.google.gwt.event.dom.client.MouseOutHandler
        See Also:
        MouseOutHandler.onMouseOut(com.google.gwt.event.dom.client.MouseOutEvent)
      • onMouseOver

        public final void onMouseOver​(com.google.gwt.event.dom.client.MouseOverEvent event)
        Specified by:
        onMouseOver in interface com.google.gwt.event.dom.client.MouseOverHandler
        See Also:
        MouseOverHandler.onMouseOver(com.google.gwt.event.dom.client.MouseOverEvent)
      • selectItem

        public void selectItem()
        Selects a item.

      • setActive

        public void setActive​(boolean active,
                              java.lang.String reason)
        Makes the menu item active or inactive.

        If the item is inactive all handlers are removed.

        Parameters:
        active - true if the item should be active, false otherwise
        reason - the reason for de-activation
      • setText

        public void setText​(java.lang.String text)
        Sets the text of the menu item.

        Parameters:
        text - the text to set
      • initWidget

        protected void initWidget​(com.google.gwt.user.client.ui.Widget widget)
        Overrides:
        initWidget in class com.google.gwt.user.client.ui.Composite
        See Also:
        Composite.initWidget(com.google.gwt.user.client.ui.Widget)
      • onHoverIn

        protected void onHoverIn​(com.google.gwt.event.dom.client.MouseOverEvent event)
        Implements the hover over action for a item.

        First closes all sub menus that are not required anymore. And then reopens the necessary sub menus and activates the selected item.

        Parameters:
        event - the mouse over event
      • onHoverOut

        protected void onHoverOut​(com.google.gwt.event.dom.client.MouseOutEvent event)
        Implements the hover out action for a item.

        If a menu item has no sub menu it will be deselected.

        Parameters:
        event - the mouse out event
      • setParentMenu

        protected void setParentMenu​(CmsContextMenu parentMenu)
        Sets the parent menu of this menu item.

        Parameters:
        parentMenu - the parent menu to set
      • setSubMenu

        protected void setSubMenu​(CmsContextMenu subMenu)
        Sets the sub menu for the menu item.

        Parameters:
        subMenu - the sub menu to set