Class TouchBarNavRenderer

java.lang.Object
org.vaadin.addons.joelpop.appnavlayout.ui.layout.appnav.TouchBarNavRenderer
All Implemented Interfaces:
NavRenderer

public class TouchBarNavRenderer extends Object
Default NavRenderer for NavType.TOUCH — a bottom icon bar in NavSlots.touchBar(), with a "More" overflow trigger when more root sections exist than fit, plus a two-level drill-down bar in NavSlots.headerNav().

Override createOverflowComponent(List, Button, Map) to replace the overflow presentation (e.g. an expand chevron or a swipeable strip) while keeping everything else unchanged.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.vaadin.flow.component.button.Button
    createNavButton(com.vaadin.flow.component.Component content, Class<? extends com.vaadin.flow.component.Component> viewClass)
    Builds a nav-bar item Button wrapping content, themed so an .active item (this add-on's own CSS, keyed off that class) picks up whichever theme is actually loaded's own accent color, and navigating to viewClass on click (or doing nothing on click if null — the "More" overflow trigger has no route of its own).
    protected com.vaadin.flow.component.Component
    createOverflowComponent(List<com.vaadin.flow.server.menu.MenuEntry> overflowEntries, com.vaadin.flow.component.button.Button overflowTrigger, Map<NavNode, com.vaadin.flow.component.button.Button> overflowButtonsOut)
    Creates the overflow-triggering component shown alongside the "More" bar item — default: a Popover listing the overflowing entries.
    The chrome this renderer requires — determines which NavStrategy gets built for whichever scenario this renderer is configured for.
    protected com.vaadin.flow.component.HasComponents
    Returns the location this renderer's primary bar belongs in — NavSlots.sideRail() or NavSlots.touchBar(), depending on the concrete subclass.
    void
    Builds or updates this renderer's content for the current nav state.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TouchBarNavRenderer

      public TouchBarNavRenderer()
  • Method Details

    • primarySlot

      protected com.vaadin.flow.component.HasComponents primarySlot(NavSlots slots)
      Returns the location this renderer's primary bar belongs in — NavSlots.sideRail() or NavSlots.touchBar(), depending on the concrete subclass.
    • render

      public void render(NavRenderContext context)
      Description copied from interface: NavRenderer
      Builds or updates this renderer's content for the current nav state. Called once when this scenario becomes active, again on every completed navigation, and again whenever nav configuration changes (grouper swap, path matcher change). The implementation decides which slot(s) in context.slots() to populate and how — including any overflow or drill-down scaffolding it needs (a "More…" popover, a chevron, a swipeable container, etc).
      Specified by:
      render in interface NavRenderer
    • createNavButton

      protected com.vaadin.flow.component.button.Button createNavButton(com.vaadin.flow.component.Component content, Class<? extends com.vaadin.flow.component.Component> viewClass)
      Builds a nav-bar item Button wrapping content, themed so an .active item (this add-on's own CSS, keyed off that class) picks up whichever theme is actually loaded's own accent color, and navigating to viewClass on click (or doing nothing on click if null — the "More" overflow trigger has no route of its own).

      theme="tertiary" is a cross-theme-consistent variant name, not a Lumo-only mechanism despite ButtonVariant.LUMO_TERTIARY's legacy "LUMO_" naming — Aura's own button.css keys off the identical theme="tertiary" attribute, and the un-themed base package supplies its own sensible default too. This is what lets an .active item pick up the active theme's own accent color (Lumo blue, Aura's accent, neutral under base) automatically, matching vaadin-side-nav-item's own selected-item color — the inactive state is forced back to the neutral secondary color in CSS (app-nav-layout.ts).

      Exposed (not just used internally by AbstractTouchNavRenderer.navItem(String, Icon, Class)) so a createOverflowComponent(List, Button, Map) override that still wants per-entry buttons doesn't have to reimplement this theming/wiring by hand — reuse this rather than constructing a Button directly, or the item risks silently losing the theme-adaptive color this method exists to guarantee.

    • createOverflowComponent

      protected com.vaadin.flow.component.Component createOverflowComponent(List<com.vaadin.flow.server.menu.MenuEntry> overflowEntries, com.vaadin.flow.component.button.Button overflowTrigger, Map<NavNode, com.vaadin.flow.component.button.Button> overflowButtonsOut)
      Creates the overflow-triggering component shown alongside the "More" bar item — default: a Popover listing the overflowing entries. Override to replace the overflow presentation (e.g. an expand chevron or a swipeable strip) while keeping bar layout, active highlighting, and header-nav delegation unchanged. Implementations that want the "More" item to highlight while one of their entries is active should populate overflowButtonsOut the same way this default does. If the replacement presentation still uses one button per entry, build them via createNavButton(Component, Class) rather than a plain new Button(...) to keep the same theme-adaptive active-color behavior.