Class CmsContextMenuWidget
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- org.opencms.ui.client.contextmenu.CmsContextMenuWidget
-
- All Implemented Interfaces:
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.IsWidget
public class CmsContextMenuWidget extends com.google.gwt.user.client.ui.Widget
Client side implementation for ContextMenu component.Adapted from ContextMenu by Peter Lehto / Vaadin Ltd.
-
-
Constructor Summary
Constructors Constructor Description CmsContextMenuWidget()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.gwt.event.shared.HandlerRegistration
addCloseHandler(com.google.gwt.event.logical.shared.CloseHandler<com.google.gwt.user.client.ui.PopupPanel> popupCloseHandler)
Adds a menu popup close handler.void
addRootMenuItem(org.opencms.ui.shared.CmsContextMenuState.ContextMenuItemState rootItem, CmsContextMenuConnector connector)
Adds new item as context menu root item.void
clearItems()
Clears the menu items.protected boolean
eventTargetContextMenu(com.google.gwt.user.client.Event nativeEvent)
Returns whether the given event targets the context menu.com.google.gwt.user.client.ui.Widget
getExtensionTarget()
Returns the extension target widget.void
hide()
Hides the menu popup.boolean
isHideAutomatically()
Returns whether the menu is set to hide automatically.protected boolean
isShowing()
Returns whether the menu is showing.void
setExtensionTarget(com.google.gwt.user.client.ui.Widget extensionTarget)
Sets the extension target.void
setHideAutomatically(boolean hideAutomatically)
Sets the hide automatically flag.void
showContextMenu(int rootMenuX, int rootMenuY)
Shows the context menu at the given position.void
showContextMenu(com.google.gwt.user.client.ui.Widget widget)
Shows the context menu relative to the given widget.void
unregister()
Unregisters the menu.-
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, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, 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, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
-
-
-
-
Constructor Detail
-
CmsContextMenuWidget
public CmsContextMenuWidget()
Constructor.
-
-
Method Detail
-
addCloseHandler
public com.google.gwt.event.shared.HandlerRegistration addCloseHandler(com.google.gwt.event.logical.shared.CloseHandler<com.google.gwt.user.client.ui.PopupPanel> popupCloseHandler)
Adds a menu popup close handler.- Parameters:
popupCloseHandler
- the close handler- Returns:
- the handler registration
-
addRootMenuItem
public void addRootMenuItem(org.opencms.ui.shared.CmsContextMenuState.ContextMenuItemState rootItem, CmsContextMenuConnector connector)
Adds new item as context menu root item.- Parameters:
rootItem
- the root itemconnector
- the connector
-
clearItems
public void clearItems()
Clears the menu items.
-
getExtensionTarget
public com.google.gwt.user.client.ui.Widget getExtensionTarget()
Returns the extension target widget.- Returns:
- the extension target widget
-
hide
public void hide()
Hides the menu popup.
-
isHideAutomatically
public boolean isHideAutomatically()
Returns whether the menu is set to hide automatically.- Returns:
true
if the menu is set to hide automatically
-
setExtensionTarget
public void setExtensionTarget(com.google.gwt.user.client.ui.Widget extensionTarget)
Sets the extension target.- Parameters:
extensionTarget
- the etension target
-
setHideAutomatically
public void setHideAutomatically(boolean hideAutomatically)
Sets the hide automatically flag.- Parameters:
hideAutomatically
- the hide automatically flag
-
showContextMenu
public void showContextMenu(int rootMenuX, int rootMenuY)
Shows the context menu at the given position.- Parameters:
rootMenuX
- the client x positionrootMenuY
- the client y position
-
showContextMenu
public void showContextMenu(com.google.gwt.user.client.ui.Widget widget)
Shows the context menu relative to the given widget.- Parameters:
widget
- the widget
-
unregister
public void unregister()
Unregisters the menu.
-
eventTargetContextMenu
protected boolean eventTargetContextMenu(com.google.gwt.user.client.Event nativeEvent)
Returns whether the given event targets the context menu.- Parameters:
nativeEvent
- the event to check- Returns:
true
if the event targets the menu
-
isShowing
protected boolean isShowing()
Returns whether the menu is showing.- Returns:
true
if the menu is showing
-
-