public interface MenuItem extends Serializable
Modifier and Type | Method and Description |
---|---|
MenuItem |
addItem(String caption,
Menu.Command command)
Add a new item inside this item, thus creating a sub-menu.
|
MenuItem |
addItem(String caption,
com.vaadin.server.Resource icon,
Menu.Command command)
Add a new item inside this item, thus creating a sub-menu.
|
MenuItem |
addItemBefore(String caption,
com.vaadin.server.Resource icon,
Menu.Command command,
MenuItem itemToAddBefore)
Add an item before some item.
|
MenuItem |
addSeparator()
Adds a separator to this menu.
|
MenuItem |
addSeparatorBefore(MenuItem itemToAddBefore) |
List<MenuItem> |
getChildren()
This will return the children of this item or null if there are none.
|
Menu.Command |
getCommand()
For the associated command.
|
String |
getDescription()
Gets the items's description.
|
com.vaadin.server.Resource |
getIcon()
Gets the objects icon.
|
int |
getId()
Get the unique identifier for this item.
|
MenuItem |
getParent()
For the containing item.
|
int |
getSize()
Returns the number of children.
|
String |
getStyleName() |
String |
getText()
Gets the objects text
|
boolean |
hasChildren()
Checks if the item has children (if it is a sub-menu).
|
boolean |
isCheckable()
Gets the checkable state of the item - whether the item has checked and
unchecked states.
|
boolean |
isChecked()
Gets the checked state of the item (checked or unchecked).
|
boolean |
isEnabled() |
boolean |
isSeparator() |
boolean |
isVisible() |
void |
removeChild(MenuItem item)
Remove the first occurrence of the item.
|
void |
removeChildren()
Empty the list of children items.
|
void |
setCheckable(boolean checkable)
Sets the checkable state of the item.
|
void |
setChecked(boolean checked)
Sets the checked state of the item.
|
void |
setCommand(Menu.Command command)
Set the command for this item.
|
void |
setDescription(String description)
Sets the items's description.
|
void |
setEnabled(boolean enabled) |
void |
setIcon(com.vaadin.server.Resource icon)
Sets the icon.
|
void |
setStyleName(String styleName) |
void |
setText(String text)
Set the text of this object.
|
void |
setVisible(boolean visible) |
boolean hasChildren()
MenuItem addSeparator()
MenuItem addItem(String caption, Menu.Command command)
caption
- the text for the menu itemcommand
- the command for the menu itemMenuItem addItem(String caption, com.vaadin.server.Resource icon, Menu.Command command) throws IllegalStateException
caption
- the text for the menu itemicon
- the icon for the menu itemcommand
- the command for the menu itemIllegalStateException
- If the item is checkable and thus cannot have children.MenuItem addItemBefore(String caption, com.vaadin.server.Resource icon, Menu.Command command, MenuItem itemToAddBefore) throws IllegalStateException
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 itemIllegalStateException
- If the item is checkable and thus cannot have children.Menu.Command getCommand()
com.vaadin.server.Resource getIcon()
MenuItem getParent()
MenuItem
, or null if there is noneList<MenuItem> getChildren()
String getText()
int getSize()
int getId()
void setCommand(Menu.Command command)
command
- The MenuCommand of this itemvoid setIcon(com.vaadin.server.Resource icon)
icon
- The icon for this itemvoid setText(String text)
text
- Text for this objectvoid removeChild(MenuItem item)
item
- The item to be removedvoid removeChildren()
void setEnabled(boolean enabled)
boolean isEnabled()
void setVisible(boolean visible)
boolean isVisible()
boolean isSeparator()
void setStyleName(String styleName)
String getStyleName()
void setDescription(String description)
getDescription()
for more
information on what the description is. This method will trigger a menu
item repaint.description
- the new description string for the component.String getDescription()
Gets the items's description. The description can be used to briefly describe the state of the item to the user. The description string may contain certain XML tags:
Tag | Description | Example |
<b> | bold | bold text |
<i> | italic | italic text |
<u> | underlined | underlined text |
<br> | linebreak | N/A |
<ul> <li>item1 <li>item1 </ul> |
item list |
|
These tags may be nested.
String
boolean isCheckable()
isChecked()
) is indicated in the UI.
An item is not checkable by default.
void setCheckable(boolean checkable) throws IllegalStateException
isChecked()
) is indicated in the UI.
An item is not checkable by default.
Items with sub items cannot be checkable.
checkable
- true if the item should be checkable, false otherwiseIllegalStateException
- If the item has childrenboolean isChecked()
isCheckable()
). The
checked state is indicated in the UI with the item, if the item is
checkable.
An item is not checked by default.
The CSS style corresponding to the checked state is "-checked".
void setChecked(boolean checked)
isCheckable()
). The checked state is indicated in
the UI with the item, if the item is checkable.
An item is not checked by default.
The CSS style corresponding to the checked state is "-checked".
Copyright © 2017 Magnolia International Ltd.. All rights reserved.