Package org.opencms.gwt.client.ui
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
-
-
Field Summary
Fields Modifier and Type Field Description protected CmsPushButton
m_button
The menu button.protected CmsToolbarPopup
m_popup
The menu content.protected com.google.gwt.event.shared.HandlerRegistration
m_resizeRegistration
Registration of the window resize handler.
-
Constructor Summary
Constructors Modifier Constructor Description protected
CmsMenuButton()
Constructor.CmsMenuButton(java.lang.String buttonText, java.lang.String imageClass)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.gwt.event.shared.HandlerRegistration
addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
protected void
autoClose()
Called on auto close.void
clear()
Removes all content from menu.void
closeMenu()
Closes the menu and fires the on toggle event.void
disable(java.lang.String disabledReason)
Disables the menu button.void
enable()
Enables or disables the button.protected CmsPopup
getPopup()
Returns the popup content.void
hide()
Hides the menu content as well as the menu connector.protected void
hideMenu()
Hides the menu content without altering the button state.protected boolean
isEnabled()
Returns if this button is enabled.boolean
isOpen()
Returns if the menu is open.boolean
isOpenRight()
Returns the isOpenRight.void
onBrowserEvent(com.google.gwt.user.client.Event event)
void
openMenu()
Opens the menu and fires the on toggle event.protected void
setButtonDown()
Sets the button to its 'down state'.protected void
setButtonUp()
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
show()
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
-
-
-
-
Field Detail
-
m_button
@UiField protected CmsPushButton m_button
The menu button.
-
m_popup
protected CmsToolbarPopup m_popup
The menu content.
-
m_resizeRegistration
protected com.google.gwt.event.shared.HandlerRegistration m_resizeRegistration
Registration of the window resize handler.
-
-
Constructor Detail
-
CmsMenuButton
@UiConstructor public CmsMenuButton(java.lang.String buttonText, java.lang.String imageClass)
Constructor.- Parameters:
buttonText
- the menu button textimageClass
- the menu button image sprite class
-
CmsMenuButton
protected CmsMenuButton()
Constructor.
-
-
Method Detail
-
addClickHandler
public com.google.gwt.event.shared.HandlerRegistration addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
- Specified by:
addClickHandler
in interfacecom.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(java.lang.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 interfacecom.google.gwt.user.client.EventListener
- Overrides:
onBrowserEvent
in classcom.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.
-
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.
-
-