public class ContextMenu extends com.vaadin.server.AbstractExtension implements Menu
Modifier and Type | Class and Description |
---|---|
static class |
ContextMenu.ContextMenuClosedEvent
ContextMenuClosedEvent is an event fired by the context menu
when it's closed.
|
static interface |
ContextMenu.ContextMenuClosedListener
ContextMenuClosedListener is used to listen for the event that the context menu is closed, either
when a item is clicked or when the popup is canceled.
|
static interface |
ContextMenu.ContextMenuOpenListener
End of delegates to AbstractMenu
|
Menu.Command
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener
Constructor and Description |
---|
ContextMenu(com.vaadin.ui.AbstractComponent parentComponent,
boolean setAsMenuForParentComponent) |
Modifier and Type | Method and Description |
---|---|
void |
addContextMenuCloseListener(ContextMenu.ContextMenuClosedListener contextMenuClosedListener)
Adds listener that will be invoked when context menu is closed.
|
void |
addContextMenuOpenListener(ContextMenu.ContextMenuOpenListener contextMenuComponentListener) |
MenuItem |
addItem(String caption,
Menu.Command command)
Delegates to AbstractMenu
|
MenuItem |
addItem(String caption,
com.vaadin.server.Resource icon,
Menu.Command command)
Add a new item to the menu bar.
|
MenuItem |
addItemBefore(String caption,
com.vaadin.server.Resource icon,
Menu.Command command,
MenuItem itemToAddBefore)
Add an item before some item.
|
MenuItem |
addSeparator() |
MenuItem |
addSeparatorBefore(MenuItem itemToAddBefore) |
void |
beforeClientResponse(boolean initial) |
protected com.vaadin.event.ContextClickEvent.ContextClickListener |
getContextClickListener() |
List<MenuItem> |
getItems()
Returns a list with all the MenuItem objects in the menu bar
|
int |
getSize()
Returns the size of the menu.
|
protected MenuSharedState |
getState() |
boolean |
isHtmlContentAllowed()
Checks whether item captions are interpreted as html or plain text.
|
void |
open() |
void |
open(int x,
int y) |
void |
removeItem(MenuItem item)
Remove first occurrence the specified item from the main menu
|
void |
removeItems()
Empty the menu bar
|
void |
setAsContextMenuOf(com.vaadin.event.ContextClickEvent.ContextClickNotifier component)
Sets this as a context menu of the component.
|
void |
setHtmlContentAllowed(boolean htmlContentAllowed)
Sets whether html is allowed in the item captions.
|
extend, getParent, getSupportedParentType, remove, setParent
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, attach, createState, detach, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getState, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isConnectorEnabled, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addAttachListener, addDetachListener, attach, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
public ContextMenu(com.vaadin.ui.AbstractComponent parentComponent, boolean setAsMenuForParentComponent)
parentComponent
- The component to whose lifecycle the context menu is tied to.setAsMenuForParentComponent
- Determines if this menu will be shown for the parent
component.public void addContextMenuCloseListener(ContextMenu.ContextMenuClosedListener contextMenuClosedListener)
contextMenuClosedListener
- public void open()
public void setAsContextMenuOf(com.vaadin.event.ContextClickEvent.ContextClickNotifier component)
component
- the component to set the context menu topublic void addContextMenuOpenListener(ContextMenu.ContextMenuOpenListener contextMenuComponentListener)
public void beforeClientResponse(boolean initial)
beforeClientResponse
in interface com.vaadin.server.ClientConnector
beforeClientResponse
in class com.vaadin.server.AbstractClientConnector
public void open(int x, int y)
protected MenuSharedState getState()
getState
in class com.vaadin.server.AbstractClientConnector
protected com.vaadin.event.ContextClickEvent.ContextClickListener getContextClickListener()
public MenuItem addSeparator()
public MenuItem addItem(String caption, Menu.Command command)
public MenuItem addItem(String caption, com.vaadin.server.Resource icon, Menu.Command command)
Menu
public MenuItem addItemBefore(String caption, com.vaadin.server.Resource icon, Menu.Command command, MenuItem itemToAddBefore)
Menu
addItemBefore
in interface Menu
caption
- the text for the menu itemicon
- the icon for the menu itemcommand
- the command for the menu itemitemToAddBefore
- the item that will be after the new itempublic List<MenuItem> getItems()
Menu
public void removeItem(MenuItem item)
Menu
removeItem
in interface Menu
item
- The item to be removedpublic void removeItems()
Menu
removeItems
in interface Menu
public int getSize()
Menu
public void setHtmlContentAllowed(boolean htmlContentAllowed)
Menu
setHtmlContentAllowed
in interface Menu
htmlContentAllowed
- true if the captions are used as html, false if used as plain
textpublic boolean isHtmlContentAllowed()
Menu
isHtmlContentAllowed
in interface Menu
Menu.setHtmlContentAllowed(boolean)
Copyright © 2017 Magnolia International Ltd.. All rights reserved.