Class AppNavItem
java.lang.Object
com.vaadin.flow.component.Component
com.gruppox.pissir23.components.appnav.AppNavItem
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
@JsModule("@vaadin-component-factory/vcf-nav")
@Tag("vcf-nav-item")
public class AppNavItem
extends com.vaadin.flow.component.Component
A menu item for the
AppNav component.
Can contain a label and/or an icon and links to a given path.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAppNavItem(String label) Creates a menu item which does not link to any view but only shows the given label.AppNavItem(String label, Class<? extends com.vaadin.flow.component.Component> view) Creates a new menu item using the given label that links to the given view.AppNavItem(String label, Class<? extends com.vaadin.flow.component.Component> view, com.vaadin.flow.component.Component icon) Creates a new menu item using the given label that links to the given view.AppNavItem(String label, String path) Creates a new menu item using the given label that links to the given path.AppNavItem(String label, String path, com.vaadin.flow.component.Component icon) Creates a new menu item using the given label and icon that links to the given path. -
Method Summary
Modifier and TypeMethodDescriptionaddItem(AppNavItem... appNavItems) Adds menu item(s) inside this item, creating a hierarchy.getLabel()Gets the label for the item.getPath()Removes all menu items from this item.removeItem(AppNavItem appNavItem) Removes the given menu item from this item.setExpanded(boolean value) Sets the expanded status of the item.setIcon(com.vaadin.flow.component.Component icon) Sets the icon for the item.Set a textual label for the item.Sets the view this item links to.Sets the path this item links to.Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
AppNavItem
Creates a menu item which does not link to any view but only shows the given label.- Parameters:
label- the label for the item
-
AppNavItem
Creates a new menu item using the given label that links to the given path.- Parameters:
label- the label for the itempath- the path to link to
-
AppNavItem
Creates a new menu item using the given label that links to the given view.- Parameters:
label- the label for the itemview- the view to link to
-
AppNavItem
Creates a new menu item using the given label and icon that links to the given path.- Parameters:
label- the label for the itempath- the path to link toicon- the icon for the item
-
AppNavItem
public AppNavItem(String label, Class<? extends com.vaadin.flow.component.Component> view, com.vaadin.flow.component.Component icon) Creates a new menu item using the given label that links to the given view.- Parameters:
label- the label for the itemview- the view to link toicon- the icon for the item
-
-
Method Details
-
removeAllItems
Removes all menu items from this item.- Returns:
- this item for chaining
-
getLabel
Gets the label for the item.- Returns:
- the label or null if no label has been set
-
setLabel
Set a textual label for the item.The label is also available for screen rader users.
- Parameters:
label- the label to set- Returns:
- this instance for chaining
-
setPath
Sets the path this item links to.- Parameters:
path- the path to link to- Returns:
- this instance for chaining
-
setPath
Sets the view this item links to.- Parameters:
view- the view to link to- Returns:
- this instance for chaining
-
getPath
-
setIcon
Sets the icon for the item.Can also be used to set a custom component to be shown in front of the label.
- Parameters:
icon- the icon to show- Returns:
- this instance for chaining
-
setExpanded
Sets the expanded status of the item.- Parameters:
value- true to expand the item, false to collapse it