Class ContextMenuItem
java.lang.Object
com.levigo.jadice.web.client.ui.menu.contextmenu.ContextMenuItem
- Direct Known Subclasses:
ContextMenuItemCommand
,ContextMenuItemSubMenu
Abstract class for all a menu or context menu item.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContextMenuHandler
protected com.google.gwt.user.client.ui.IsWidget
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
_onKeyDown
(com.google.gwt.event.dom.client.KeyDownEvent event) abstract boolean
execute
(com.google.gwt.dom.client.Element rowElement) Overriden in subclasses.Returns the key stroke string.getLabel()
Returns the label of the item.void
hide()
void
init
(com.google.gwt.user.client.ui.IsWidget parentWidget, ContextMenuHandler handler) Initializes the menu item with a parent widget and aContextMenuHandler
.abstract boolean
Returns whether this item is a sub-menu or notvoid
onAttach()
Call on attach.void
onDetach()
Call on detach.final void
onKeyDown
(com.google.gwt.event.dom.client.KeyDownEvent event, boolean isLocal) Fired when a KeyEvent was firedprotected void
setAvailable
(boolean available) protected void
setEnabled
(boolean enabled) void
setHover
(boolean hover) Sets whether the icon is hovered or not.protected void
setSelected
(boolean selected)
-
Field Details
-
handler
-
parentWidget
protected com.google.gwt.user.client.ui.IsWidget parentWidget
-
-
Constructor Details
-
ContextMenuItem
Constructor.- Parameters:
action
- theAction
providing the content for this context menu item
-
-
Method Details
-
getLabel
Returns the label of the item.- Returns:
- the label
-
getKeyStrokeString
Returns the key stroke string.- Returns:
- the string
-
setSelected
protected void setSelected(boolean selected) -
setEnabled
protected void setEnabled(boolean enabled) -
setAvailable
protected void setAvailable(boolean available) -
setHover
public void setHover(boolean hover) Sets whether the icon is hovered or not.- Parameters:
hover
- true if the icon is hovered, false if not
-
onKeyDown
public final void onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event, boolean isLocal) Fired when a KeyEvent was fired- Parameters:
event
- theKeyDownEvent
isLocal
- true when mnemonic can fire
-
_onKeyDown
protected void _onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event) -
execute
public abstract boolean execute(com.google.gwt.dom.client.Element rowElement) Overriden in subclasses.- Parameters:
rowElement
- An element that can be used to dynamically place the new context menu entry.- Returns:
- True if it was successfully executed (stop propagation, prevent default browser behavior).
-
onAttach
public void onAttach()Call on attach. Executes attach actions. -
onDetach
public void onDetach()Call on detach. Executes detach actions. -
hide
public void hide()
-