public class Text extends Component implements HasText
Text node doesn't support setting any attribute or property so you may not
use Element API (and Text
doesn't provide any such contract) for
setting attribute/property. It implies that you may not style this component
as well. Any attempt to set attribute/property value throws an exception. The
only available API for a Text
component is set a text.
If you need a text component which can be styled then check Span
class (from flow-html-components
) module.
Constructor and Description |
---|
Text(String text)
Creates an instance using the given text.
|
Modifier and Type | Method and Description |
---|---|
String |
getText()
Gets the text of the component.
|
protected <T> void |
set(PropertyDescriptor<T,?> descriptor,
T value)
Sets the value of the given component property.
|
void |
setId(String id)
The method is not supported for the
Text class. |
void |
setText(String text)
Sets the text of the component.
|
void |
setVisible(boolean visible)
The method is not supported for the
Text class. |
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, setElement
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getElement
addAttachListener
addDetachListener
public Text(String text)
text
- the text to show, null
is interpreted as an empty
stringpublic void setText(String text)
public String getText()
protected <T> void set(PropertyDescriptor<T,?> descriptor, T value)
Component
set
in class Component
T
- type of the value to setdescriptor
- the descriptor for the property to set, not null
value
- the new property value to setPropertyDescriptor
public void setId(String id)
Text
class.
Always throws an UnsupportedOperationException
.
setId
in class Component
id
- the id to set, or ""
to remove any previously set
idUnsupportedOperationException
public void setVisible(boolean visible)
Text
class.
Always throws an UnsupportedOperationException
.
setVisible
in class Component
visible
- the component visibility valueUnsupportedOperationException
Copyright © 2021. All rights reserved.