public class AppLayoutMenu extends Object implements HasElement, AttachNotifier
Constructor and Description |
---|
AppLayoutMenu()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
AppLayoutMenuItem |
addMenuItem(AppLayoutMenuItem item)
Adds item to the menu.
|
AppLayoutMenuItem |
addMenuItem(Component icon)
Constructs a new object with the given icon.
|
AppLayoutMenuItem |
addMenuItem(Component icon,
ComponentEventListener<MenuItemClickEvent> listener)
Constructs a new object with the given icon and click listener.
|
AppLayoutMenuItem |
addMenuItem(Component icon,
String title)
Constructs a new object with the given icon and title.
|
AppLayoutMenuItem |
addMenuItem(Component icon,
String title,
ComponentEventListener<MenuItemClickEvent> listener)
Constructs a new object with the given icon, title and click listener.
|
AppLayoutMenuItem |
addMenuItem(Component icon,
String title,
String route)
Constructs a new object with the given icon, title and route.
|
AppLayoutMenuItem |
addMenuItem(String title)
Constructs a new object with the given title.
|
AppLayoutMenuItem |
addMenuItem(String title,
ComponentEventListener<MenuItemClickEvent> listener)
Constructs a new object with the given title and click listener.
|
void |
addMenuItems(AppLayoutMenuItem... menuItems)
Adds menu items to the menu.
|
void |
clearMenuItems()
Removes all menu items.
|
Element |
getElement()
Gets the element associated with this instance.
|
Optional<AppLayoutMenuItem> |
getMenuItemTargetingRoute(String route)
Gets the first
AppLayoutMenuItem targeting a route. |
AppLayoutMenuItem |
getSelectedMenuItem()
Gets the currently selected menu item.
|
void |
removeMenuItem(AppLayoutMenuItem menuItem)
Removes
AppLayoutMenuItem from the menu |
void |
selectMenuItem(AppLayoutMenuItem menuItem)
Selects a menu item.
|
void |
setMenuItems(AppLayoutMenuItem... menuItems)
Clears existing menu items and sets the new the arguments.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttachListener
public void setMenuItems(AppLayoutMenuItem... menuItems)
menuItems
- items of the type AppLayoutMenuItem
to setpublic void addMenuItems(AppLayoutMenuItem... menuItems)
menuItems
- items of the type AppLayoutMenuItem
to addpublic AppLayoutMenuItem addMenuItem(String title)
title
- the title to displaypublic AppLayoutMenuItem addMenuItem(AppLayoutMenuItem item)
item
- AppLayoutMenuItem
to addpublic AppLayoutMenuItem addMenuItem(Component icon)
icon
- the icon to displaypublic AppLayoutMenuItem addMenuItem(Component icon, String title)
icon
- the icon to displaytitle
- the title to displaypublic AppLayoutMenuItem addMenuItem(Component icon, String title, String route)
icon
- the icon to displaytitle
- the title to displayroute
- the route to navigate on clickpublic AppLayoutMenuItem addMenuItem(Component icon, ComponentEventListener<MenuItemClickEvent> listener)
icon
- the icon to displaylistener
- the menu item click listenerpublic AppLayoutMenuItem addMenuItem(String title, ComponentEventListener<MenuItemClickEvent> listener)
title
- the title to displaylistener
- the menu item click listenerpublic AppLayoutMenuItem addMenuItem(Component icon, String title, ComponentEventListener<MenuItemClickEvent> listener)
icon
- the icon to displaytitle
- the title to displaylistener
- the menu item click listenerpublic void removeMenuItem(AppLayoutMenuItem menuItem)
AppLayoutMenuItem
from the menupublic void clearMenuItems()
public void selectMenuItem(AppLayoutMenuItem menuItem)
menuItem
- AppLayoutMenuItem
to selectpublic Optional<AppLayoutMenuItem> getMenuItemTargetingRoute(String route)
AppLayoutMenuItem
targeting a route.route
- route to match to AppLayoutMenuItem.getRoute()
AppLayoutMenuItem
wrapped in an Optional
, if found.public AppLayoutMenuItem getSelectedMenuItem()
AppLayoutMenuItem
selected menu item.public Element getElement()
getElement
in interface HasElement
Copyright © 2019. All rights reserved.