Class Toolbar
- All Implemented Interfaces:
Animatable<Toolbar>
,CanDrop<Toolbar>
,Draggable<Toolbar>
,Scrollable<Toolbar>
Toolbar component
The toolbar component places components (by default, Buttons) on a bar. Please note that the Toolbar component is used for grouping the assigned components, it doesn't handle them, and isn't responsible for their color/operation.
- 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 TypeMethodDescriptionaddButton
(ButtonType buttonType, Icon icon, String title, ClickEventHandler clickHandler) Adds a button component, with the specified style, icon, title and click handler to the toolbar.Adds a button component to the toolbar.addButton
(DropDownButton btn) Adds a button component to the toolbar.addButton
(Icon icon, String title, ClickEventHandler clickHandler) Adds a button component, with the specified icon, title and click handler, to the toolbar.addButtons
(Component<?>... buttons) Adds multiple button components to the toolbar, in the order they are specified.setButtonSize
(ButtonSize buttonSize) Sets the default button size for the toolbar buttons.setButtonType
(ButtonType buttonType) Sets the default button type for the toolbar buttons.setVisible
(boolean visible) Sets the visibility of the component.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, 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.Draggable
addDragEndEventHandler, addDragStartEventHandler, setDraggable
Methods inherited from interface com.jbstrap.ui.Scrollable
addScrollHandler
-
Constructor Details
-
Toolbar
public Toolbar()Creates an empty Toolbar- Throws:
IllegalStateException
- If the component is set to be both Private and Public, through an annotation.
-
Toolbar
Creates an empty Toolbar with specified ID- Parameters:
id
- The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)- Throws:
IllegalStateException
- If the component is set to be both Private and Public, through an annotation.
-
-
Method Details
-
setButtonType
Sets the default button type for the toolbar buttons. This defaults to theDEFAULT
type. The button type specified here will be used for buttons, that don't have their types set individually.- Parameters:
buttonType
- The button type of the toolbar button. For the applicable types, see theButtonType
enum.- Returns:
- The toolbar component
-
setButtonSize
Sets the default button size for the toolbar buttons. This defaults to theDEFAULT
type. The button size specified here will be used for buttons, that don't have their sizes set individually.- Parameters:
buttonSize
- The button size of the toolbar button. For the applicable sizes, see theButtonSize
enum.- Returns:
- The toolbar component
-
addButton
Adds a button component to the toolbar.- Parameters:
btn
- The button component- Returns:
- The toolbar component
-
addButton
Adds a button component to the toolbar.- Parameters:
btn
- The button component- Returns:
- The toolbar component
-
addButtons
Adds multiple button components to the toolbar, in the order they are specified.- Parameters:
buttons
- The button components- Returns:
- The toolbar component
-
addButton
Adds a button component, with the specified icon, title and click handler, to the toolbar.- Parameters:
icon
- The icon of the button. For the applicable icons, see theIcon
enum. If specified asnull
, the button won't have an icontitle
- The title of the button. If specified asnull
, the button won't have any text on itclickHandler
- TheClickEventHandler
implementation.- Returns:
- The toolbar component
-
addButton
public Toolbar addButton(ButtonType buttonType, Icon icon, String title, ClickEventHandler clickHandler) Adds a button component, with the specified style, icon, title and click handler to the toolbar.- Parameters:
buttonType
- The style of the toolbar button. For the applicable types, see theButtonType
enum. For the applicable sizes, see theButtonSize
enum. The specified style overwrites the default button size/type.icon
- The icon of the button. For the applicable icons, see theIcon
enum. If specified asnull
, the button won't have an icontitle
- The title of the button. If specified asnull
, the button won't have any text on itclickHandler
- TheClickEventHandler
implementation.- Returns:
- The toolbar 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
. -
setVisible
Sets the visibility of the component. If not visible, the component won't appear on the interface, but it will be drawn in the HTML DOM. The visibility can be set anytime through code. By default, the component is visible- Overrides:
setVisible
in classComponent<Toolbar>
- Parameters:
visible
- Iftrue
, the component is visible, iffalse
, it is hidden- Returns:
- The component
-