Class VerticalNavigation

  • All Implemented Interfaces:
    Attachable

    public class VerticalNavigation
    extends Object
    implements Attachable
    An element which implements the vertical navigation from PatternFly.

    The vertical navigation consists of two parts:

    1. Items: The actual menu / navigation items which are child elements of the vertical navigation
    2. Panes: The panes which are not children of the vertical navigation. The panes are typically children of the root container. Their visibility is controlled by the vertical navigation.

    The vertical navigation itself is not a child but a sibling of the root container. It gets attached / detached to the DOM by calling attach() and detach().

    There are two groups of methods:

    • add*(): Use these methods to add panes before the panes were added to the DOM
    • insert*(): Use these methods to add panes after the panes were added to the DOM
    See Also:
    https://www.patternfly.org/patterns/vertical-with-persistent-secondary/
    • Constructor Detail

      • VerticalNavigation

        public VerticalNavigation()
    • Method Detail

      • addPrimary

        public VerticalNavigation addPrimary​(String id,
                                             String text)
        Adds a primary navigation item which acts a container for secondary navigation items.
      • addPrimary

        public VerticalNavigation addPrimary​(String id,
                                             String text,
                                             String iconClass,
                                             org.jboss.elemento.IsElement element)
        Adds a primary navigation item to the navigation which controls the visibility of the specified element.

        Unlike similar UI elements such as Tabs the element is not added as a child of this navigation. The element should be rather a child of the root container.

        Please note
        This method does not add the item to the DOM. This has to be done manually using something like

         HTMLElement root = row()
                 .add(column()
                         .addAll(navigation.panes()))
                 .get();
         
      • insertPrimary

        public void insertPrimary​(String id,
                                  String beforeId,
                                  String text,
                                  String iconClass,
                                  org.jboss.elemento.IsElement element)
        Inserts a primary navigation item before the specified item. If beforeId is null, the item is inserted as last item. If there's not item with id beforeId, an error message is logged and no item is inserted.

        You must call this method after at least one item was added and before the navigation is attached.

        Please note
        Unlike addPrimary(String, String, String, IsElement), this method does add the item to the DOM.

      • insertPrimary

        public void insertPrimary​(String id,
                                  String beforeId,
                                  String text,
                                  String iconClass,
                                  elemental2.dom.HTMLElement element)
      • addSecondary

        public VerticalNavigation addSecondary​(String primaryId,
                                               String id,
                                               String text,
                                               elemental2.dom.HTMLElement element)
        Adds a secondary navigation item to the navigation which controls the visibility of the specified element.

        Unlike similar UI elements such as Tabs the element is not added as a child of this navigation. The element should be rather a child of the root container.

        Please note
        This method does not add the item to the DOM. This has to be done manually using something like

         HTMLElement root = row()
                 .add(column()
                         .addAll(navigation.panes()))
                 .get();
         
      • insertSecondary

        public void insertSecondary​(String primaryId,
                                    String id,
                                    String beforeId,
                                    String text,
                                    elemental2.dom.HTMLElement element)
        Inserts a secondary navigation item before the specified item. If beforeId is null, the item is inserted as last item. If there's not item with id beforeId, an error message is logged and no item is inserted.

        You must call this method after at least one item was added and before the navigation is attached.

        Please note
        Unlike addSecondary(String, String, String, HTMLElement), this method does add the item to the DOM.

      • show

        public void show​(String id)
      • setVisible

        public void setVisible​(String id,
                               boolean visible)
        Controls the visibility of the specified item.
      • onShow

        public void onShow​(String id,
                           org.jboss.hal.spi.Callback callback)
      • updateBadge

        public void updateBadge​(String id,
                                int count)
      • panes

        public Iterable<elemental2.dom.HTMLElement> panes()
        Returns the elements which were registered using the add() methods. Use this method to add those elements to another container.