|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.ui.MenuBar
public class MenuBar
A class representing a horizontal menu bar. The menu can contain MenuItem objects, which in turn can contain more MenuBars. These sub-level MenuBars are represented as vertical menu.
Nested Class Summary | |
---|---|
static interface |
MenuBar.Command
This interface contains the layer for menu commands of the MenuBar class. |
class |
MenuBar.MenuItem
A composite class for menu items and sub-menus. |
Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
---|
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener |
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector |
---|
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener |
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable |
---|
Sizeable.Unit |
Field Summary |
---|
Fields inherited from interface com.vaadin.server.Sizeable |
---|
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS |
Constructor Summary | |
---|---|
MenuBar()
Constructs an empty, horizontal menu |
Method Summary | |
---|---|
MenuBar.MenuItem |
addItem(java.lang.String caption,
MenuBar.Command command)
Add a new item to the menu bar. |
MenuBar.MenuItem |
addItem(java.lang.String caption,
Resource icon,
MenuBar.Command command)
Add a new item to the menu bar. |
MenuBar.MenuItem |
addItemBefore(java.lang.String caption,
Resource icon,
MenuBar.Command command,
MenuBar.MenuItem itemToAddBefore)
Add an item before some item. |
void |
changeVariables(java.lang.Object source,
java.util.Map<java.lang.String,java.lang.Object> variables)
Deserialize changes received from client. |
void |
focus()
Sets the focus for this component if the component is Focusable . |
java.util.List<MenuBar.MenuItem> |
getItems()
Returns a list with all the MenuItem objects in the menu bar |
MenuBar.MenuItem |
getMoreMenuItem()
Get the MenuItem used as the collapse menu item. |
int |
getSize()
Returns the size of the menu. |
protected com.vaadin.shared.ui.menubar.MenuBarState |
getState()
Returns the shared state bean with information to be sent from the server to the client. |
int |
getTabIndex()
Gets the tabulator index of the Focusable component. |
boolean |
isAutoOpen()
Detects whether the menubar is in a mode where top level menus are automatically opened when the mouse cursor is moved over the menu. |
boolean |
isHtmlContentAllowed()
Checks whether item captions are interpreted as html or plain text. |
void |
paintContent(PaintTarget target)
Paint (serialise) the component for the client. |
void |
removeItem(MenuBar.MenuItem item)
Remove first occurrence the specified item from the main menu |
void |
removeItems()
Empty the menu bar |
void |
setAutoOpen(boolean autoOpenTopLevelMenu)
Using this method menubar can be put into a special mode where top level menus opens without clicking on the menu, but automatically when mouse cursor is moved over the menu. |
void |
setHtmlContentAllowed(boolean htmlContentAllowed)
Sets whether html is allowed in the item captions. |
void |
setMoreMenuItem(MenuBar.MenuItem item)
Set the item that is used when collapsing the top level menu. |
void |
setTabIndex(int tabIndex)
Sets the tabulator index of the Focusable component. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.vaadin.ui.LegacyComponent |
---|
markAsDirty |
Methods inherited from interface com.vaadin.server.VariableOwner |
---|
isEnabled, isImmediate |
Methods inherited from interface com.vaadin.ui.Component |
---|
addListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible |
Methods inherited from interface com.vaadin.server.ClientConnector |
---|
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler |
Methods inherited from interface com.vaadin.shared.Connector |
---|
getConnectorId |
Methods inherited from interface com.vaadin.server.Sizeable |
---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth |
Constructor Detail |
---|
public MenuBar()
Method Detail |
---|
protected com.vaadin.shared.ui.menubar.MenuBarState getState()
AbstractComponent
getState
in class AbstractComponent
public void paintContent(PaintTarget target) throws PaintException
paintContent
in interface LegacyComponent
target
- the target UIDL stream where the component should paint itself
to.
PaintException
- if the paint operation failed.public void changeVariables(java.lang.Object source, java.util.Map<java.lang.String,java.lang.Object> variables)
changeVariables
in interface VariableOwner
source
- the Source of the variable change. This is the origin of the
event. For example in Web Adapter this is the request.variables
- the Mapping from variable names to new variable values.public MenuBar.MenuItem addItem(java.lang.String caption, MenuBar.Command command)
caption
- the text for the menu itemcommand
- the command for the menu item
java.lang.IllegalArgumentException
public MenuBar.MenuItem addItem(java.lang.String caption, Resource icon, MenuBar.Command command)
caption
- the text for the menu itemicon
- the icon for the menu itemcommand
- the command for the menu item
java.lang.IllegalArgumentException
public MenuBar.MenuItem addItemBefore(java.lang.String caption, Resource icon, MenuBar.Command command, MenuBar.MenuItem itemToAddBefore)
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 item
java.lang.IllegalArgumentException
public java.util.List<MenuBar.MenuItem> getItems()
public void removeItem(MenuBar.MenuItem item)
item
- The item to be removedpublic void removeItems()
public int getSize()
public void setMoreMenuItem(MenuBar.MenuItem item)
item
- public MenuBar.MenuItem getMoreMenuItem()
public void setAutoOpen(boolean autoOpenTopLevelMenu)
Note, that on touch devices the menu still opens on a click event.
autoOpenTopLevelMenu
- true if menus should be opened without click, the default is
falsepublic boolean isAutoOpen()
public void setHtmlContentAllowed(boolean htmlContentAllowed)
htmlContentAllowed
- true if the captions are used as html, false if used as plain
textpublic boolean isHtmlContentAllowed()
setHtmlContentAllowed(boolean)
public int getTabIndex()
Component.Focusable
Focusable
component.
getTabIndex
in interface Component.Focusable
Focusable
componentComponent.Focusable.setTabIndex(int)
public void setTabIndex(int tabIndex)
Component.Focusable
Focusable
component.
The tab index property is used to specify the order in which the
fields are focused when the user presses the Tab key. Components with
a defined tab index are focused sequentially first, and then the
components with no tab index.
Form loginBox = new Form(); loginBox.setCaption("Login"); layout.addComponent(loginBox); // Create the first field which will be focused TextField username = new TextField("User name"); loginBox.addField("username", username); // Set focus to the user name username.focus(); TextField password = new TextField("Password"); loginBox.addField("password", password); Button login = new Button("Login"); loginBox.getFooter().addComponent(login); // An additional component which natural focus order would // be after the button. CheckBox remember = new CheckBox("Remember me"); loginBox.getFooter().addComponent(remember); username.setTabIndex(1); password.setTabIndex(2); remember.setTabIndex(3); // Different than natural place login.setTabIndex(4);
After all focusable user interface components are done, the browser can begin again from the component with the smallest tab index, or it can take the focus out of the page, for example, to the location bar.
If the tab index is not set (is set to zero), the default tab order is used. The order is somewhat browser-dependent, but generally follows the HTML structure of the page.
A negative value means that the component is completely removed from the tabulation order and can not be reached by pressing the Tab key at all.
setTabIndex
in interface Component.Focusable
tabIndex
- the tab order of this component. Indexes usually start
from 1. Zero means that default tab order should be used.
A negative value means that the field should not be
included in the tabbing sequence.Component.Focusable.getTabIndex()
public void focus()
AbstractComponent
Focusable
.
focus
in interface Component.Focusable
focus
in class AbstractComponent
FieldEvents
,
FieldEvents.FocusEvent
,
FieldEvents.FocusListener
,
FieldEvents.BlurEvent
,
FieldEvents.BlurListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |