Class CmsContextMenuItemWidget
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.FocusWidget
-
- org.opencms.ui.client.contextmenu.CmsContextMenuItemWidget
-
- All Implemented Interfaces:
com.google.gwt.event.dom.client.HasAllDragAndDropHandlers
,com.google.gwt.event.dom.client.HasAllFocusHandlers
,com.google.gwt.event.dom.client.HasAllGestureHandlers
,com.google.gwt.event.dom.client.HasAllKeyHandlers
,com.google.gwt.event.dom.client.HasAllMouseHandlers
,com.google.gwt.event.dom.client.HasAllTouchHandlers
,com.google.gwt.event.dom.client.HasBlurHandlers
,com.google.gwt.event.dom.client.HasClickHandlers
,com.google.gwt.event.dom.client.HasDoubleClickHandlers
,com.google.gwt.event.dom.client.HasDragEndHandlers
,com.google.gwt.event.dom.client.HasDragEnterHandlers
,com.google.gwt.event.dom.client.HasDragHandlers
,com.google.gwt.event.dom.client.HasDragLeaveHandlers
,com.google.gwt.event.dom.client.HasDragOverHandlers
,com.google.gwt.event.dom.client.HasDragStartHandlers
,com.google.gwt.event.dom.client.HasDropHandlers
,com.google.gwt.event.dom.client.HasFocusHandlers
,com.google.gwt.event.dom.client.HasGestureChangeHandlers
,com.google.gwt.event.dom.client.HasGestureEndHandlers
,com.google.gwt.event.dom.client.HasGestureStartHandlers
,com.google.gwt.event.dom.client.HasKeyDownHandlers
,com.google.gwt.event.dom.client.HasKeyPressHandlers
,com.google.gwt.event.dom.client.HasKeyUpHandlers
,com.google.gwt.event.dom.client.HasMouseDownHandlers
,com.google.gwt.event.dom.client.HasMouseMoveHandlers
,com.google.gwt.event.dom.client.HasMouseOutHandlers
,com.google.gwt.event.dom.client.HasMouseOverHandlers
,com.google.gwt.event.dom.client.HasMouseUpHandlers
,com.google.gwt.event.dom.client.HasMouseWheelHandlers
,com.google.gwt.event.dom.client.HasTouchCancelHandlers
,com.google.gwt.event.dom.client.HasTouchEndHandlers
,com.google.gwt.event.dom.client.HasTouchMoveHandlers
,com.google.gwt.event.dom.client.HasTouchStartHandlers
,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.Focusable
,com.google.gwt.user.client.ui.HasEnabled
,com.google.gwt.user.client.ui.HasFocus
,com.google.gwt.user.client.ui.HasVisibility
,com.google.gwt.user.client.ui.IsWidget
,com.google.gwt.user.client.ui.SourcesClickEvents
,com.google.gwt.user.client.ui.SourcesFocusEvents
,com.google.gwt.user.client.ui.SourcesKeyboardEvents
,com.google.gwt.user.client.ui.SourcesMouseEvents
public class CmsContextMenuItemWidget extends com.google.gwt.user.client.ui.FocusWidget
ContextMenuItemWidget is client side widget that represents one menu item in context menu.Adapted from ContextMenu by Peter Lehto / Vaadin Ltd.
-
-
Field Summary
Fields Modifier and Type Field Description protected com.vaadin.client.ui.Icon
m_icon
The icon.
-
Constructor Summary
Constructors Constructor Description CmsContextMenuItemWidget()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSubMenuItem(CmsContextMenuItemWidget contextMenuItem)
Adds given context menu item into the sub menu of this item.void
clearItems()
Removes all the items from the submenu of this item.void
closeSiblingMenus()
Closes the sibling menu.protected void
closeThisAndSelectParent()
Closes this item and selects the parent.boolean
eventTargetsPopup(com.google.gwt.user.client.Event nativeEvent)
Checks whether the given event targets the menu popup.java.lang.String
getId()
Returns the id.CmsContextMenuItemWidget
getParentItem()
Returns the parent item.boolean
hasSubMenu()
Returns if the item has a sub menu.void
hideSubMenu()
Hides the sub menu that's been opened from this item.boolean
isRootItem()
Returns whether this is the root item.boolean
isSubmenuOpen()
Returns if the sub menu is open.protected boolean
onItemClicked()
Called when context menu item is clicked or is focused and enter is pressed.protected void
selectLowerSibling()
Selects the next sibling.protected void
selectUpperSibling()
Selects the previous sibling.void
setCaption(java.lang.String caption)
Sets the caption.void
setEnabled(boolean enabled)
void
setFocus(boolean focused)
void
setIcon(com.vaadin.client.ui.Icon icon)
Sets the icon.void
setId(java.lang.String id)
Sets the id.void
setOverlay(org.opencms.ui.client.contextmenu.CmsContextMenuOverlay owner)
Sets the menu component to which this item belongs to.void
setParentItem(CmsContextMenuItemWidget parentItem)
Sets parent item meaning that this item is in the sub menu of given parent item.void
setRootComponent(CmsContextMenuWidget rootComponent)
Sets the root component.void
setSeparatorVisible(boolean separatorVisible)
Sets the separator visibility.-
Methods inherited from class com.google.gwt.user.client.ui.FocusWidget
addBlurHandler, addClickHandler, addClickListener, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addFocusHandler, addFocusListener, addGestureChangeHandler, addGestureEndHandler, addGestureStartHandler, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler, getFocusImpl, getTabIndex, isEnabled, onAttach, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener, setAccessKey, setTabIndex
-
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, 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
-
-
-
-
Field Detail
-
m_icon
protected com.vaadin.client.ui.Icon m_icon
The icon.
-
-
Constructor Detail
-
CmsContextMenuItemWidget
public CmsContextMenuItemWidget()
Constructor.
-
-
Method Detail
-
addSubMenuItem
public void addSubMenuItem(CmsContextMenuItemWidget contextMenuItem)
Adds given context menu item into the sub menu of this item.- Parameters:
contextMenuItem
- the menu item
-
clearItems
public void clearItems()
Removes all the items from the submenu of this item. If this menu item does not have a sub menu, this call has no effect.
-
closeSiblingMenus
public void closeSiblingMenus()
Closes the sibling menu.
-
eventTargetsPopup
public boolean eventTargetsPopup(com.google.gwt.user.client.Event nativeEvent)
Checks whether the given event targets the menu popup.- Parameters:
nativeEvent
- the event to check- Returns:
true
if given event targets the overlay of this menu item or overlay of any of this item's child item.
-
getId
public java.lang.String getId()
Returns the id.- Returns:
- the id
-
getParentItem
public CmsContextMenuItemWidget getParentItem()
Returns the parent item.- Returns:
- menu item that opened the menu to which this item belongs
-
hasSubMenu
public boolean hasSubMenu()
Returns if the item has a sub menu.- Returns:
true
if this item has a sub menu
-
hideSubMenu
public void hideSubMenu()
Hides the sub menu that's been opened from this item.
-
isRootItem
public boolean isRootItem()
Returns whether this is the root item.- Returns:
true
if this item is an item in the root menu
-
isSubmenuOpen
public boolean isSubmenuOpen()
Returns if the sub menu is open.- Returns:
true
if this menu has a sub menu and it's open
-
setCaption
public void setCaption(java.lang.String caption)
Sets the caption.- Parameters:
caption
- the caption to set
-
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabled
in interfacecom.google.gwt.user.client.ui.HasEnabled
- Overrides:
setEnabled
in classcom.google.gwt.user.client.ui.FocusWidget
- See Also:
FocusWidget.setEnabled(boolean)
-
setFocus
public void setFocus(boolean focused)
- Specified by:
setFocus
in interfacecom.google.gwt.user.client.ui.Focusable
- Overrides:
setFocus
in classcom.google.gwt.user.client.ui.FocusWidget
- See Also:
FocusWidget.setFocus(boolean)
-
setIcon
public void setIcon(com.vaadin.client.ui.Icon icon)
Sets the icon.- Parameters:
icon
- the icon
-
setId
public void setId(java.lang.String id)
Sets the id.- Parameters:
id
- the id
-
setOverlay
public void setOverlay(org.opencms.ui.client.contextmenu.CmsContextMenuOverlay owner)
Sets the menu component to which this item belongs to.- Parameters:
owner
- the owner
-
setParentItem
public void setParentItem(CmsContextMenuItemWidget parentItem)
Sets parent item meaning that this item is in the sub menu of given parent item.- Parameters:
parentItem
- the parent item
-
setRootComponent
public void setRootComponent(CmsContextMenuWidget rootComponent)
Sets the root component.- Parameters:
rootComponent
- the root component
-
setSeparatorVisible
public void setSeparatorVisible(boolean separatorVisible)
Sets the separator visibility.- Parameters:
separatorVisible
-true
to set the separator visible
-
closeThisAndSelectParent
protected void closeThisAndSelectParent()
Closes this item and selects the parent.
-
onItemClicked
protected boolean onItemClicked()
Called when context menu item is clicked or is focused and enter is pressed.- Returns:
true
if context menu was closed after the click
-
selectLowerSibling
protected void selectLowerSibling()
Selects the next sibling.
-
selectUpperSibling
protected void selectUpperSibling()
Selects the previous sibling.
-
-