All Implemented Interfaces:
Invertible<Navbar>, Serializable, Iterable<Component>, IEventSink, IEventSource, IFeedbackContributor, IConverterLocator, IMetadataContext<Serializable,Component>, IQueueRegion, IHeaderContributor, IRequestableComponent, IHierarchical<Component>, IClusterable

public class Navbar extends Panel implements Invertible<Navbar>
A Navbar is a navigation component that holds a list of elements, mostly Links/MenuButtons/Dropdowns.
<div wicket:id="navbar" class="navbar"></div>
Author:
miha
See Also:
  • Constructor Details

    • Navbar

      public Navbar(String componentId)
      Construct.
      Parameters:
      componentId - The non-null id of this component
    • Navbar

      public Navbar(String componentId, IModel<?> model)
      Construct.
      Parameters:
      componentId - The non-null id of this component
      model - The component's model
  • Method Details

    • componentId

      public static String componentId()
      Returns:
      the component id that is used for all navbar components.
    • onInitialize

      protected void onInitialize()
      Overrides:
      onInitialize in class MarkupContainer
    • newContainer

      protected TransparentWebMarkupContainer newContainer(String componentId)
      creates a new transparent inner container which is used to append some css classes.
      Parameters:
      componentId - The non-null id of a new navigation component
      Returns:
      a new inner container of the navigation bar.
    • isFluid

      public boolean isFluid()
      Returns:
      true, if the navigation is rendered for a fluid page layout.
    • fluid

      public Navbar fluid(boolean fluid)
      marks the navigation to be rendered inside a fluid page layout.
      Returns:
      the component's current instance.
    • onComponentTag

      protected void onComponentTag(ComponentTag tag)
      Overrides:
      onComponentTag in class Component
    • newNavigation

      protected Component newNavigation(String componentId, IModel<List<Component>> listModel)
      creates a new navigation list
      Parameters:
      componentId - The non-null id of a new navigation component
      listModel - The component's model
      Returns:
      a new navigation list view instance
    • newBrandNameLink

      protected Component newBrandNameLink(String componentId)
      creates a new brand name button.
      Parameters:
      componentId - The non-null id of a new navigation component
      Returns:
      a new brand name page link instance
    • newBrandLabel

      protected Label newBrandLabel(String markupId)
      Parameters:
      markupId - The component's markup id
      Returns:
      a new brand name label.
    • newBrandImage

      protected Image newBrandImage(String markupId)
      Parameters:
      markupId - The component's markup id
      Returns:
      a new Image
    • getHomePage

      protected Class<? extends Page> getHomePage()
      Returns:
      the page class which is used for the brand name link. The application's homepage is used by default.
    • getPosition

      public Navbar.Position getPosition()
      Returns:
      true, if the navigation is fixed on the top of the screen.
    • getBackgroundColor

      public BackgroundColorBehavior.Color getBackgroundColor()
      Returns:
      background color of navbar
    • getCollapseBreakpoint

      public Navbar.CollapseBreakpoint getCollapseBreakpoint()
      Returns:
      the breakpoint when navigation bar is collapsed
    • addComponents

      public final Navbar addComponents(INavbarComponent... components)
      adds a component to the given position inside the navbar
      Parameters:
      components - the components to add
      Returns:
      this component instance for chaining
    • addComponents

      public final Navbar addComponents(NavbarText component)
      adds a component to the given position inside the navbar
      Parameters:
      component - the component to add
      Returns:
      this component instance for chaining
    • newExtraItemId

      public final String newExtraItemId()
    • addComponents

      public final Navbar addComponents(List<INavbarComponent> components)
      adds a component to the given position inside the navbar
      Parameters:
      components - the components to add
      Returns:
      this component instance for chaining
    • newToggleNavigationLabel

      protected Label newToggleNavigationLabel(String componentId)
      creates a new button label
      Parameters:
      componentId - the wicket component id
      Returns:
      new label instance
    • newCollapseButton

      protected TransparentWebMarkupContainer newCollapseButton(String componentId, String selector)
      creates a new transparent container which is used to append the "data-bs-target" attribute to the collapse button.
      Parameters:
      componentId - The non-null id of collapse button
      selector - non-null jquery selector to collapse
      Returns:
      a button container.
    • newCollapseContainer

      protected TransparentWebMarkupContainer newCollapseContainer(String componentId)
      creates a new transparent inner container which is used to append some css classes.
      Parameters:
      componentId - The non-null id of a new navigation component
      Returns:
      a new inner container of the navigation bar.
    • setBrandName

      public Navbar setBrandName(IModel<String> brandName)
      sets the label of the brand name button
      Parameters:
      brandName - the brand name label
      Returns:
      the component's current instance
    • setBrandImage

      public Navbar setBrandImage(ResourceReference imageResourceReference, IModel<String> imageAltAttrModel)
      sets an image in the brand button
      Parameters:
      imageResourceReference - required
      imageAltAttrModel - optional, but should be provided
      Returns:
      this instance for chaining
    • setInverted

      public Navbar setInverted(boolean invert)
      inverts the navbar backgorund color
      Specified by:
      setInverted in interface Invertible<Navbar>
      Parameters:
      invert - whether to invert the color or not
      Returns:
      the component's current instance
    • setBackgroundColor

      public Navbar setBackgroundColor(BackgroundColorBehavior.Color color)
      Sets background color of navbar.
      Parameters:
      color - the background color
      Returns:
      the component's current instace
    • setPosition

      public Navbar setPosition(Navbar.Position position)
      Sets the preferred position of the navigation bar on the screen.
      Returns:
      the component's current instance.
    • setCollapseBreakdown

      public Navbar setCollapseBreakdown(Navbar.CollapseBreakpoint breakpoint)
      Sets the preferred responsive collapsing of navigation bar.
      Parameters:
      breakpoint - the breakpoint for collapsing navigation bar
      Returns:
      the component's current instance
    • detachModel

      protected void detachModel()
      Overrides:
      detachModel in class Component