Class NavigationView
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.orderedlayout.VerticalLayout
org.vaadin.firitin.components.orderedlayout.VVerticalLayout
org.vaadin.firitin.layouts.NavigationView
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.orderedlayout.VerticalLayout>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasOrderedComponents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.orderedlayout.FlexComponent, com.vaadin.flow.component.orderedlayout.ThemableLayout, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.orderedlayout.VerticalLayoutVariant>, Serializable, FluentAttachNotifier<VVerticalLayout>, FluentClickNotifier<com.vaadin.flow.component.orderedlayout.VerticalLayout, VVerticalLayout>, FluentComponent<VVerticalLayout>, FluentDetachNotifier<VVerticalLayout>, FluentHasComponents<VVerticalLayout>, FluentHasSize<VVerticalLayout>, FluentHasStyle<VVerticalLayout>, FluentThemableLayout<VVerticalLayout>, HasPadding<VVerticalLayout>
A view one level down from the front page: the floating header — the way
back, the title, the view's actions — and a content area that scrolls
correctly. Extend it, set a title,
add the content; the header is
already there.
The name is Vaadin TouchKit's, which took it from the iOS of its day, and
the shape is the same one both were describing: an application whose front
page is the menu, and whose every other screen is a titled view with a way up
in its top corner. SubViewHeader is the bar; this is the view around
it, for the classes that would otherwise all compose the same three lines.
What extending buys, besides the header:
- A height that scrolls right. A floor rather than
setSizeFull(): a view pinned to the viewport's height ends there and takes its bottom padding with it, so anything past one screenful finishes flush against the end of the document — on a phone that reads as a page cut off rather than one that has ended. A minimum keeps what full height was for (a short page still fills the screen) and lets the box grow. - The title in one place.
setTitle(String)names the view in the bar; the browser tab is still the view's own business (HasDynamicTitle), because only the view knows what several of its tabs need to be told apart by. - The way back, re-aimable. The target given at construction is the
static case;
setBackTarget(Class, Object)is for a view whose "up" is itself a parameterised route, known only once the URL arrives.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent
com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment, com.vaadin.flow.component.orderedlayout.FlexComponent.JustifyContentMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNavigationView(Class<? extends com.vaadin.flow.component.Component> backTarget, String backLabel) protectedNavigationView(String title, Class<? extends com.vaadin.flow.component.Component> backTarget, String backLabel) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAction(com.vaadin.flow.component.Component... actions) Puts the view's own controls at the right edge of the bar, mirroring the way back.<T, C extends com.vaadin.flow.component.Component & com.vaadin.flow.router.HasUrlParameter<T>>
voidsetBackTarget(Class<? extends C> backTarget, T parameter) Re-aims the way back at a parameterised route — a detail view's sub-view goes back to/thing/42, not to/thing— with the parameter the URL handed over.voidNames the view in the bar.Methods inherited from class VVerticalLayout
addExpanded, alignAll, onAttach, ui, withAlignItems, withAlignSelf, withComponent, withComponent, withDefaultHorizontalComponentAlignment, withExpand, withExpanded, withFlexGrow, withJustifyContentMode, withPaddingMethods inherited from class com.vaadin.flow.component.orderedlayout.VerticalLayout
addAndExpand, getAlignItems, getAlignSelf, getDefaultHorizontalComponentAlignment, getHorizontalComponentAlignment, setAlignItems, setAlignSelf, setDefaultHorizontalComponentAlignment, setHorizontalComponentAlignment, setPadding, setSpacingMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisibleMethods inherited from class 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.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent
expand, getFlexGrow, getFlexShrink, getJustifyContentMode, replace, setFlexGrow, setFlexShrink, setJustifyContentModeMethods inherited from interface FluentAttachNotifier
withAttachListenerMethods inherited from interface FluentClickNotifier
withClickListenerMethods inherited from interface FluentComponent
navigate, setId, setVisible, withId, withVisibleMethods inherited from interface FluentDetachNotifier
withDetachListenerMethods inherited from interface FluentHasComponents
children, descendants, withComponentAsFirst, withComponentAtIndex, withComponentsMethods inherited from interface FluentHasSize
addResizeListener, withFullHeight, withFullWidth, withHeight, withMaxHeight, withMaxSize, withMaxWidth, withMinHeight, withMinSize, withMinWidth, withSize, withSizeFull, withSizeUndefined, withWidthMethods inherited from interface FluentHasStyle
getStyle, withAddedClassName, withClassName, withStyleMethods inherited from interface FluentThemableLayout
withBoxSizing, withMargin, withSpacingMethods inherited from interface com.vaadin.flow.component.HasComponents
addMethods inherited from interface com.vaadin.flow.component.HasComponentsOfType
add, add, addComponentAsFirst, addComponentAtIndex, bindChildren, getChildren, getComponentAt, getComponentCount, indexOf, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface HasPadding
setPadding, setPadding, setPadding, withPadding, withPadding, withPaddingMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, bindThemeVariant, bindThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariantsMethods inherited from interface com.vaadin.flow.component.orderedlayout.ThemableLayout
getBoxSizing, getSpacing, getThemeList, isMargin, isPadding, isSpacing, isWrap, setBoxSizing, setMargin, setPadding, setSpacing, setSpacing, setSpacing, setWrap
-
Constructor Details
-
NavigationView
-
NavigationView
-
-
Method Details
-
setTitle
Names the view in the bar. Callable late: titles often come from a URL. -
setBackTarget
public <T, C extends com.vaadin.flow.component.Component & com.vaadin.flow.router.HasUrlParameter<T>> void setBackTarget(Class<? extends C> backTarget, T parameter) Re-aims the way back at a parameterised route — a detail view's sub-view goes back to/thing/42, not to/thing— with the parameter the URL handed over. -
addAction
public void addAction(com.vaadin.flow.component.Component... actions) Puts the view's own controls at the right edge of the bar, mirroring the way back. Icon-only buttons arrive dressed as the arrow's twin.
-