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>

public class NavigationView extends 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

    Constructors
    Modifier
    Constructor
    Description
    protected
    NavigationView(Class<? extends com.vaadin.flow.component.Component> backTarget, String backLabel)
     
    protected
    NavigationView(String title, Class<? extends com.vaadin.flow.component.Component> backTarget, String backLabel)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    <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.
    void
    Names the view in the bar.

    Methods inherited from class com.vaadin.flow.component.orderedlayout.VerticalLayout

    addAndExpand, getAlignItems, getAlignSelf, getDefaultHorizontalComponentAlignment, getHorizontalComponentAlignment, setAlignItems, setAlignSelf, setDefaultHorizontalComponentAlignment, setHorizontalComponentAlignment, setPadding, setSpacing

    Methods 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, setVisible

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.ClickNotifier

    addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent

    expand, getFlexGrow, getFlexShrink, getJustifyContentMode, replace, setFlexGrow, setFlexShrink, setJustifyContentMode

    Methods inherited from interface FluentAttachNotifier

    withAttachListener

    Methods inherited from interface FluentClickNotifier

    withClickListener

    Methods inherited from interface FluentComponent

    navigate, setId, setVisible, withId, withVisible

    Methods inherited from interface FluentDetachNotifier

    withDetachListener

    Methods inherited from interface FluentHasStyle

    getStyle, withAddedClassName, withClassName, withStyle

    Methods inherited from interface FluentThemableLayout

    withBoxSizing, withMargin, withSpacing

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add

    Methods inherited from interface com.vaadin.flow.component.HasComponentsOfType

    add, add, addComponentAsFirst, addComponentAtIndex, bindChildren, getChildren, getComponentAt, getComponentCount, indexOf, remove, remove, removeAll

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    bindEnabled, isEnabled, setEnabled

    Methods 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, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasTheme

    addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName

    Methods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant

    addThemeVariants, bindThemeVariant, bindThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariants

    Methods 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

      protected NavigationView(Class<? extends com.vaadin.flow.component.Component> backTarget, String backLabel)
      Parameters:
      backTarget - the view one level up
      backLabel - where the arrow goes, for whoever cannot see that it is an arrow — the link's accessible name
    • NavigationView

      protected NavigationView(String title, Class<? extends com.vaadin.flow.component.Component> backTarget, String backLabel)
  • Method Details

    • setTitle

      public void setTitle(String title)
      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.