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 drill-down bar in NavSlots.headerNav() for nested routes, however deep they go.

Override createOverflowComponent(List, Button, Map) to replace what's shown in response to tapping the "More" trigger (e.g. a Dialog) 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, 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

    Methods inherited from interface NavRenderer

    railWidth
  • 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, and navigating to viewClass on click (or doing nothing on click if null — the "More" overflow trigger has no route of its own).

      Plain, borderless, transparent-background chrome comes from this add-on's own CSS (app-nav-layout.ts, keyed off the "overflow-nav-item" class a caller adds afterward), rendering correctly under any theme, or none at all. An .active item is left at the button's own plain default text color; the inactive state is forced to the muted secondary color in that same CSS.

      Exposed (not just used internally by NavItem) so a createOverflowComponent(List, Button, Map) override that still wants per-entry buttons doesn't have to reimplement this wiring by hand — reuse this rather than constructing a Button directly.

    • 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 it with a different presentation shown in response to tapping the "More" trigger (e.g. a Dialog) 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.