Class WNavigationBar

    • Method Detail

      • setTitle

        public void setTitle​(java.lang.CharSequence title,
                             WLink link)
        Sets a title.

        The title may optionally link to a 'homepage'.

      • setResponsive

        public void setResponsive​(boolean responsive)
        Sets whether the navigation bar will respond to screen size.

        For screens that are less wide, the navigation bar can be rendered different (more compact and allowing for vertical menu layouts).

        Note: When using WBootstrap5Theme the navigation bar is responsive by default. Setting this to false has no effect. You can change the collapsing behavior by setting one of the ".navbar-expand-" style classes, see the Bootstrap documentation on navbars for more info.

      • addMenu

        public WMenu addMenu​(WMenu menu,
                             AlignmentFlag alignment)
        Adds a menu to the navigation bar.

        Typically, a navigation bar will contain at least one menu which implements the top-level navigation options allowed by the navigation bar.

        The menu may be aligned to the left or to the right of the navigation bar.

        Note: WBootstrap5Theme ignores alignment. Use classes like "me-auto" and "ms-auto" for alignment instead.

      • addFormField

        public void addFormField​(WWidget widget,
                                 AlignmentFlag alignment)
        Adds a form field to the navigation bar.

        In some cases, one may want to add a few form fields to the navigation bar (e.g. for a compact login option).

        Note: WBootstrap5Theme ignores alignment. Use classes like "me-auto" and "ms-auto" for alignment instead.

      • addSearch

        public void addSearch​(WLineEdit field,
                              AlignmentFlag alignment)
        Adds a search widget to the navigation bar.

        This is not so different from addFormField(), except that the form field may be styled differently to indicate a search function.

        Note: WBootstrap5Theme ignores alignment. Use classes like "me-auto" and "ms-auto" for alignment instead.

      • addWidget

        public void addWidget​(WWidget widget,
                              AlignmentFlag alignment)
        Adds a widget to the navigation bar.

        Any other widget may be added to the navigation bar, although they may require special CSS style to blend well with the navigation bar style.

        Note: WBootstrap5Theme ignores alignment. Use classes like "me-auto" and "ms-auto" for alignment instead.

      • getCreateCollapseButton

        protected WInteractWidget getCreateCollapseButton()
      • getCreateExpandButton

        protected WInteractWidget getCreateExpandButton()
      • render

        protected void render​(java.util.EnumSet<RenderFlag> flags)
        Description copied from class: WWidget
        Renders the widget.

        This function renders the widget (or an update for the widget), after this has been scheduled using scheduleRender().

        The default implementation will render the widget by serializing changes to JavaScript and HTML. You may want to reimplement this widget if you have been postponing some of the layout / rendering implementation until the latest moment possible. In that case you should make sure you call the base implementation however.

        Overrides:
        render in class WInteractWidget