Class VerticalNavigation
- java.lang.Object
-
- org.jboss.hal.ballroom.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:
- Items: The actual menu / navigation items which are child elements of the vertical navigation
- 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()anddetach().There are two groups of methods:
add*(): Use these methods to add panes before the panes were added to the DOMinsert*(): Use these methods to add panes after the panes were added to the DOM
-
-
Constructor Summary
Constructors Constructor Description VerticalNavigation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VerticalNavigationaddPrimary(String id, String text)Adds a primary navigation item which acts a container for secondary navigation items.VerticalNavigationaddPrimary(String id, String text, String iconClass)VerticalNavigationaddPrimary(String id, String text, String iconClass, elemental2.dom.HTMLElement element)VerticalNavigationaddPrimary(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.VerticalNavigationaddSecondary(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.voidattach()voiddetach()voidinsertPrimary(String id, String beforeId, String text, String iconClass)voidinsertPrimary(String id, String beforeId, String text, String iconClass, elemental2.dom.HTMLElement element)voidinsertPrimary(String id, String beforeId, String text, String iconClass, org.jboss.elemento.IsElement element)Inserts a primary navigation item before the specified item.voidinsertSecondary(String primaryId, String id, String beforeId, String text, elemental2.dom.HTMLElement element)Inserts a secondary navigation item before the specified item.voidonShow(String id, org.jboss.hal.spi.Callback callback)Iterable<elemental2.dom.HTMLElement>panes()Returns the elements which were registered using theadd()methods.voidsetVisible(String id, boolean visible)Controls the visibility of the specified item.voidshow(String id)voidupdateBadge(String id, int count)
-
-
-
Method Detail
-
attach
public void attach()
- Specified by:
attachin interfaceAttachable
-
detach
public void detach()
- Specified by:
detachin interfaceAttachable
-
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)
-
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
Tabsthe 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 likeHTMLElement root = row() .add(column() .addAll(navigation.panes())) .get();
-
addPrimary
public VerticalNavigation addPrimary(String id, String text, String iconClass, elemental2.dom.HTMLElement element)
-
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. IfbeforeIdisnull, the item is inserted as last item. If there's not item with idbeforeId, 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
UnlikeaddPrimary(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
Tabsthe 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 likeHTMLElement 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. IfbeforeIdisnull, the item is inserted as last item. If there's not item with idbeforeId, 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
UnlikeaddSecondary(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 theadd()methods. Use this method to add those elements to another container.
-
-