Class NavBarItem
- All Implemented Interfaces:
Animatable<ListItem>
,CanDrop<ListItem>
,Clickable<ListItem>
,Draggable<ListItem>
,Focusable<ListItem>
,HandleHotKey<ListItem>
,HandleMouseEvents<ListItem>
,Scrollable<ListItem>
,Touchable<ListItem>
NavBar
.
The component is not a standalone component, it is only displayed in the NavBar
.
The menu item component represents a menu item. You can add further menu items (sub-menu items) to a menu item, these will drop down from the main item. You can add an icon to main menu items. This is displayed before the menu item text. Sub-menu items do not display an icon.
The component cannot be permanently created.
It can only be instantiated using the NavBar.createItem
method.
Such components are created if you add a Startup
menu item to the NavBar
component using
the NavBar.addMenu
method.
You can add more menus to the NavBar
component, each one individually labeled.
You can specify a marker for each menu item. The specified marker is displayed on the right side of the menu item. You can add a text to the marker, thereby labeling the menu item. Also, you can set the marker color by specifying its type.
- Since:
- 4.0
- Author:
- JBStrap
-
Field Summary
Fields inherited from class com.jbstrap.ui.Component
animation, attributes, backgroundColor, borderColor, color, defaultHotKeyHandler, handlers, hotKeys, styleClasses, textAlign, toolTip, toolTipPosition
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a new sub-menu item to the component.protected NavBarItem
findItemByName
(String name) Gets a sub-menu item of a menu item by its name.getIcon()
Gets the icon assigned to the menu item.Gets the marker assigned to a menu item.Gets the marker text assigned to a menu item.final String
getName()
Gets a menu item name.getTitle()
Gets the title for a menu item.removeItemByName
(String name) Removes a sub menu item by its name.protected NavBarItem
setHotKey
(int hotKey) Sets the icon for a menu item.Shows a marker on the menu item (marker type specified).setMarkerText
(String markerText) Adds a default (grey) marker to the menu item.Sets the title for a menu item.Methods inherited from class com.jbstrap.ui.Component
_hide, _setAttribute, addAllowedRole, addComponent, addComponent, addComponents, addDeniedRole, addHandler, addStyle, addStyleClass, addStyleClasses, afterDraw, clearfix, closeTag, combinateAccess, containsStyle, containsStyleClass, draw, drawSubComponents, error, flattendComponentTree, getAccess, getAccessMode, getAllowedRoles, getAttribute, getAttributes, getBackgroundColor, getBorderColor, getClient, getComponentById, getComponents, getComponents, getComponentsByClass, getData, getDeniedRoles, getHandlers, getId, getLanguageCode, getParent, getParent, getRegisteredEvents, getStyle, getStyleClasses, getTextAlign, getTextColor, getToolTip, getToolTipPosition, getTypeName, getUI, init, insertComponentAfter, insertComponentBefore, isAccess, isDrawn, isEnabled, isEventBubbling, isVisible, onHide, onHotKeyEventHandler, onShow, openTag, redraw, removeAllComponents, removeAllowedRole, removeAllStyleClasses, removeAttribute, removeComponent, removeComponent, removeComponents, removeDeniedRole, removeHandler, removeStyle, removeStyle, removeStyleClass, removeStyleClasses, replaceComponent, replaceStyleClass, runAfterDraw, runJavaScript, runJavaScript, runJavaScript, runOnHide, runOnShow, say, setAttribute, setBackgroundColor, setBorder, setBorderColor, setData, setDisplayType, setEnabled, setEventBubbling, setFlex, setFloating, setHeight100, setHeight25, setHeight50, setHeight75, setHeightAuto, setLanguage, setMargin, setName, setOverflow, setPadding, setParent, setScrollable, setSelectionType, setShadow, setStyle, setTextAlign, setTextColor, setToolTip, setToolTipPosition, setVisible, setWidth100, setWidth25, setWidth50, setWidth75, setWidthAuto, showNotification, showNotification, showProcessIndicator, toggleStyleClass
Methods inherited from class com.jbstrap.core.messagebus.MessageBus
closeMessageBus, messageBusOpened, openMessageBus, renewSubscription, sendMessageToMessageBus, subscribeMessageBus, unsubscribeAllListeners, unsubscribeMessageBus
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jbstrap.ui.Animatable
addAnimationEndHandler, addAnimationStartHandler, getAnimation, removeAnimation, setAnimation
Methods inherited from interface com.jbstrap.ui.CanDrop
addDropEventHandler
Methods inherited from interface com.jbstrap.ui.Clickable
addClickHandler, addDoubleClickHandler
Methods inherited from interface com.jbstrap.ui.Draggable
addDragEndEventHandler, addDragStartEventHandler, setDraggable
Methods inherited from interface com.jbstrap.ui.Focusable
addFocusHandler, addFocusInHandler, addFocusOutHandler, addLosesFocusHandler, setFocus
Methods inherited from interface com.jbstrap.ui.HandleHotKey
addHotKey, addHotKey, removeHotKey, removeHotKeys
Methods inherited from interface com.jbstrap.ui.HandleMouseEvents
addMouseDownHandler, addMouseEnterHandler, addMouseLeaveHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler
Methods inherited from interface com.jbstrap.ui.Scrollable
addScrollHandler
Methods inherited from interface com.jbstrap.ui.Touchable
addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler
-
Constructor Details
-
NavBarItem
- Parameters:
name
- The menu item name (required for the noram menu item)header
- If settrue
create a menu header item, otherwise create normal menu item- Throws:
NullPointerException
- If create a normal menu item, vagy specified name isnull
-
-
Method Details
-
setHotKey
- Parameters:
hotKey
- The hot key- Returns:
- The menu item component
-
getName
Gets a menu item name. -
setIcon
Sets the icon for a menu item.- Parameters:
icon
- Menu item icon Ifnull
is set, no icon is displayed. Available icons are listed in the enumIcon
.- Returns:
- Menu item component
-
getIcon
Gets the icon assigned to the menu item.- Returns:
- Menu item icon or
null
if no icon is specified
-
setTitle
Sets the title for a menu item.- Parameters:
title
- Menu item title Ifnull
or an empty string is specified, no title is displayed.- Returns:
- Menu item component
-
getTitle
Gets the title for a menu item.- Returns:
- Menu item title or
null
if no title has been specified
-
setMarkerText
Adds a default (grey) marker to the menu item.- Parameters:
markerText
- Marker text- Returns:
- Menu item component
-
setMarker
Shows a marker on the menu item (marker type specified).- Parameters:
markerText
- Marker text Ifnull
is set, no marker is displayed.type
- Marker type (color) Ifnull
is set, the marker type is not modified. A list of types to be used is contained in theBadgeType
enum.- Returns:
- Menu item component
-
getMarkerText
Gets the marker text assigned to a menu item.- Returns:
- Marker text or
null
if there is no marker assigned to the menu item or no text has been specified
-
getMarker
Gets the marker assigned to a menu item.- Returns:
- Marker or
null
if there is no marker assigned to the menu item
-
addItem
Adds a new sub-menu item to the component.- Parameters:
name
- Sub menu item nametitle
- Menu item title Ifnull
is specified, an empty menu item is displayed.- Returns:
- New menu item
- Throws:
NullPointerException
- Thrown if the specified name isnull
-
findItemByName
Gets a sub-menu item of a menu item by its name.- Parameters:
name
- The menu item name searched for- Returns:
- Sub-menu item corresponding to the specified name or
null
if the specified name isnull
or there is no sub-menu item by that name
-
removeItemByName
Removes a sub menu item by its name.- Parameters:
name
- Sub menu item name to be removed- Returns:
- Menu item component