Class StaticText
Static text component
The component writes the static text to the HTML DOM. This component doesn't handle any events.
- 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
ConstructorDescriptionStaticText
(String text) Creates a static text component with the specified text -
Method Summary
Modifier and TypeMethodDescriptionaddComponent
(Component component) The Static Text component cannot have any other components assigned to it.getId()
Static text display component.getText()
Gets the static text contentredraw()
Redraws the component.setEnabled
(boolean enabled) The static text cannot be disabled, this method doesn't do anything.Sets the Static textboolean
writeHTML
(StringWriter writer) Creates the component's HTML equivalentMethods inherited from class com.jbstrap.ui.Component
_hide, _setAttribute, addAllowedRole, 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, 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, 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, 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
-
StaticText
Creates a static text component with the specified text- Parameters:
text
- The text content that will be placed in the HTML DOM- Throws:
IllegalStateException
- If the component is set to be both Private and Public, through an annotation.
-
-
Method Details
-
getText
Gets the static text content- Returns:
- The static text content or
null
, if no text is found
-
setText
Sets the Static text- Parameters:
text
- The text content that will be placed in the HTML DOM- Returns:
- The static text component
-
addComponent
The Static Text component cannot have any other components assigned to it.- Overrides:
addComponent
in classComponent<StaticText>
- Parameters:
component
- The component to be added- Returns:
- The component
- Throws:
UnsupportedOperationException
- In every case
-
setEnabled
The static text cannot be disabled, this method doesn't do anything.- Overrides:
setEnabled
in classComponent<StaticText>
- Parameters:
enabled
-true
, the component is enabled, otherwise it's disabled- Returns:
- The static text 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<StaticText>
- Returns:
- If the componentwas drawn,
true
, otherwisefalse
-
redraw
Redraws the component.All changes on the components, (even after drawing) are applied automatically. So for this reason, the components don't have to be redrawn. However, sometimes it is necessary to redraw the entire component. If this method is used, the component and all of its subcomponents will be re-sent to the client-side and the components will be re-initialized, a process that can take a significant amount of time, not to mention burden the communication channels. The use of this method for these reasons is not recommended.
- Overrides:
redraw
in classComponent<StaticText>
- Returns:
- The component
-
getId
Static text display component. There is no ID assigned for the component.- Overrides:
getId
in classComponent<StaticText>
- Returns:
- Empty string
-