Class CmsMenuButton

java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
org.opencms.gwt.client.ui.CmsMenuButton
All Implemented Interfaces:
com.google.gwt.event.dom.client.HasClickHandlers, com.google.gwt.event.logical.shared.HasAttachHandlers, 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:
A_CmsToolbarListMenuButton, A_CmsToolbarMenu, CmsContextMenuButton, CmsHoverbarContextMenuButton, CmsQuickLauncher, CmsToolbarChooseEditorModeButton

public class CmsMenuButton extends com.google.gwt.user.client.ui.Composite implements com.google.gwt.event.dom.client.HasClickHandlers
Provides a menu button.

Since:
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
    Modifier and Type
    Field
    Description
    protected CmsPushButton
    The menu button.
    protected CmsToolbarPopup
    The menu content.
    protected com.google.gwt.event.shared.HandlerRegistration
    Registration of the window resize handler.

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

    DEBUG_ID_PREFIX
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor.
     
    CmsMenuButton(String buttonText, String imageClass)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.gwt.event.shared.HandlerRegistration
    addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
     
    protected void
    Called on auto close.
    void
    Removes all content from menu.
    void
    Closes the menu and fires the on toggle event.
    void
    disable(String disabledReason)
    Disables the menu button.
    void
    Enables or disables the button.
    protected CmsPopup
    Returns the popup content.
    void
    Hides the menu content as well as the menu connector.
    protected void
    Hides the menu content without altering the button state.
    protected boolean
    Returns if this button is enabled.
    boolean
    Returns if the menu is open.
    boolean
    Returns the isOpenRight.
    void
    onBrowserEvent(com.google.gwt.user.client.Event event)
     
    void
    Opens the menu and fires the on toggle event.
    protected void
    Sets the button to its 'down state'.
    protected void
    Sets button to state up, hides menu fragments (not the content pop-up) and fires the toggle event.
    void
    setEnabled(boolean enabled)
    Enables or disables the button.
    void
    setMenuWidget(com.google.gwt.user.client.ui.Widget widget)
    This will set the menu content widget.
    void
    setOpenRight(boolean isOpenRight)
    Sets the isOpenRight.
    void
    setToolbarMode(boolean isToolbarMode)
    Sets the isToolbarMode.
    void
    Shows the menu content as well as the menu connector.

    Methods inherited from class com.google.gwt.user.client.ui.Composite

    claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, 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
  • Field Details

  • Constructor Details

    • CmsMenuButton

      @UiConstructor public CmsMenuButton(String buttonText, String imageClass)
      Constructor.

      Parameters:
      buttonText - the menu button text
      imageClass - the menu button image sprite class
    • CmsMenuButton

      protected CmsMenuButton()
      Constructor.

  • Method Details

    • 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)
    • clear

      public void clear()
      Removes all content from menu.

    • closeMenu

      public void closeMenu()
      Closes the menu and fires the on toggle event.

    • disable

      public void disable(String disabledReason)
      Disables the menu button.

      Parameters:
      disabledReason - the reason to set in the button title
    • enable

      public void enable()
      Enables or disables the button.

    • hide

      public void hide()
      Hides the menu content as well as the menu connector.

    • isOpen

      public boolean isOpen()
      Returns if the menu is open.

      Returns:
      true if the menu is opened
    • isOpenRight

      public boolean isOpenRight()
      Returns the isOpenRight.

      Returns:
      the isOpenRight
    • onBrowserEvent

      public void onBrowserEvent(com.google.gwt.user.client.Event event)
      Specified by:
      onBrowserEvent in interface com.google.gwt.user.client.EventListener
      Overrides:
      onBrowserEvent in class com.google.gwt.user.client.ui.Composite
      See Also:
      • Composite.onBrowserEvent(com.google.gwt.user.client.Event)
    • openMenu

      public void openMenu()
      Opens the menu and fires the on toggle event.

    • setEnabled

      public void setEnabled(boolean enabled)
      Enables or disables the button.

      Parameters:
      enabled - if true, enables the button, else disables it
    • setMenuWidget

      public void setMenuWidget(com.google.gwt.user.client.ui.Widget widget)
      This will set the menu content widget.

      Parameters:
      widget - the widget to set as content
    • setOpenRight

      public void setOpenRight(boolean isOpenRight)
      Sets the isOpenRight.

      Parameters:
      isOpenRight - the isOpenRight to set
    • setToolbarMode

      public void setToolbarMode(boolean isToolbarMode)
      Sets the isToolbarMode.

      Parameters:
      isToolbarMode - the isToolbarMode to set
    • show

      public void show()
      Shows the menu content as well as the menu connector.

    • autoClose

      protected void autoClose()
      Called on auto close.

    • getPopup

      protected CmsPopup getPopup()
      Returns the popup content.

      Returns:
      the popup content
    • hideMenu

      protected void hideMenu()
      Hides the menu content without altering the button state.

    • isEnabled

      protected boolean isEnabled()
      Returns if this button is enabled.

      Returns:
      true if the button is enabled
    • setButtonDown

      protected void setButtonDown()
      Sets the button to its 'down state'.
    • setButtonUp

      protected void setButtonUp()
      Sets button to state up, hides menu fragments (not the content pop-up) and fires the toggle event.