Class NavBarFooterButtonPopup
Popup menu component for buttons in the @{link NavBar
component’s footer.
Use this component to display a popup menu by pressing a button in the NavBar
footer.
The popup menu shows different items.
All displayed items are clickable. Click event handlers are individually implemented.
You can set an icon and a header text for the popup menu.
You can add items to the popup menu.
Icons or pictures are inserted before these items.
You can add a title and detail text to the items.
These are displayed in line with the specified icon or picture.
If the specified text is too long to display, only a part of the text that fits to a row will appear.
Furthermore, you can add buttons to the popup menu. Button texts appear left-aligned or center-aligned.
Click events for items and buttons are individually implemented along with the application logic.
The component is not a standalone component, it is always to be assigned to a NavBarFooterButton
component.
You cannot instantiate this component, you can only create it using the createPopup()
method.
- Since:
- 4.0
- Author:
- JBStrap
- See Also:
-
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 TypeMethodDescriptionaddButton
(String text, boolean centered, ClickEventHandler clickHandler) Adds a button with a text to the menu.addButton
(String text, ClickEventHandler clickHandler) Adds a button with a left-aligned text to the menu.Adds a divider item to the menu.addItem
(String name, Icon icon, TextType iconType, String title, String detail, ClickEventHandler clickHandler) Adds a menu item with an icon to the popup menu.Adds a menu item with an image to the popup menu.Gets the header icon in the popup menu.Gets the popup menu header text.removeItemByName
(String name) Removes a previously added item from the popup menu.Sets the popup menu header.boolean
writeHTML
(StringWriter writer) Creates the component's HTML equivalentMethods 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, getName, 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
-
Constructor Details
-
NavBarFooterButtonPopup
protected NavBarFooterButtonPopup()
-
-
Method Details
-
setHeader
Sets the popup menu header. If no header is specified or the header text and icon are set asnull
, the header is not displayed.- Parameters:
icon
- Header icon Ifnull
is set, no icon is displayed. Available icons are listed in the enumIcon
.title
- Header text Ifnull
or an empty string is specified, no text is displayed in the header.- Returns:
- Popup menu component
-
getHeaderIcon
Gets the header icon in the popup menu.- Returns:
- The icon in the popup menu header, or
null
if no icon is displayed or specified for the popup menu.
-
getHeaderText
Gets the popup menu header text.- Returns:
- The icon in the popup menu header text, or
null
if no header text is displayed or specified for the popup menu.
-
addItem
public NavBarFooterButtonPopup addItem(String name, Icon icon, TextType iconType, String title, String detail, ClickEventHandler clickHandler) Adds a menu item with an icon to the popup menu.- Parameters:
name
- Menu item name This parameter is mandatory. The menu item name must be unique in order to be properly referenced later.icon
- The icon before the menu item Ifnull
is specified, no icon is displayed before the menu item. Available icons are listed in the enumIcon
.iconType
- The icon type which determines the icon color Available types are listed in the enumTextType
.title
- Item title Ifnull
is set, no title is displayed.detail
- Item detail text This text is displayed with a fainter color next to the icon and below the item title. Ifnull
is specified, the detail text is not displayed.clickHandler
- Click handler event implementation Ifnull
is specified, the click event is not handled and the user is not able to use the given item. However, the item is visible.- Returns:
- Popup menu component
- Throws:
NullPointerException
- Thrown if the item name is specified asnull
-
addItem
public NavBarFooterButtonPopup addItem(String name, String imageUrl, String title, String detail, ClickEventHandler clickHandler) Adds a menu item with an image to the popup menu.- Parameters:
name
- Menu item name This parameter is mandatory. The menu item name must be unique in order to be properly referenced later.imageUrl
- Relative URL of the image displayed before the item The specified URL must be different from the application’s base URL. Ifnull
is specified, no image is displayed before the menu item.title
- Item title Ifnull
is set, no title is displayed.detail
- Item detail text This text is displayed with a fainter color next to the icon and below the item title. Ifnull
is specified, no detail text is displayed.clickHandler
- Click handler event implementation Ifnull
is specified, the click event is not handled, thus the user cannot handle the item but it is visible.- Returns:
- Popup menu component
- Throws:
NullPointerException
- Thrown if the item name is specified asnull
-
removeItemByName
Removes a previously added item from the popup menu. If more items match the specified name, all of them are removed.- Parameters:
name
- The name of the item to be removed- Returns:
- Popup menu component
-
addButton
Adds a button with a left-aligned text to the menu.- Parameters:
text
- Button text Ifnull
is specified, the button is displayed without a text.clickHandler
- Click event handler implementation Ifnull
is specified, the button will be inactive.- Returns:
- Popup menu component
-
addButton
public NavBarFooterButtonPopup addButton(String text, boolean centered, ClickEventHandler clickHandler) Adds a button with a text to the menu.- Parameters:
text
- Button text Ifnull
is specified, the button is displayed without a text.centered
- Iftrue
is specified, the button text is aligned to the center Otherwise, it is displayed left-aligned.clickHandler
- Click event handler implementation Ifnull
is specified, the button will be inactive.- Returns:
- Popup menu component
-
addDivider
Adds a divider item to the menu.- Returns:
- Popup menu component
-
writeHTML
Description copied from class:Component
Creates the component's HTML equivalentThis method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (
StringWriter
class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return withfalse
. Otherwise, it must return withtrue
.- Specified by:
writeHTML
in classComponent<NavBarFooterButtonPopup>
- Returns:
- If the componentwas drawn,
true
, otherwisefalse
-