Class Text
- All Implemented Interfaces:
AttachNotifier
,DetachNotifier
,HasElement
,HasStyle
,HasText
,Serializable
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.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
HasText.WhiteSpace
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassName
(String className) The method is not supported for theText
class.void
addClassNames
(String... classNames) The method is not supported for theText
class.getText()
Gets the text of the component.boolean
removeClassName
(String className) The method is not supported for theText
class.void
removeClassNames
(String... classNames) The method is not supported for theText
class.protected <T> void
set
(PropertyDescriptor<T, ?> descriptor, T value) Sets the value of the given component property.void
setClassName
(String className) The method is not supported for theText
class.void
setClassName
(String className, boolean set) The method is not supported for theText
class.void
The method is not supported for theText
class.void
Sets the text of the component.void
setVisible
(boolean visible) The method is not supported for theText
class.Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, setElement
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods inherited from interface com.vaadin.flow.component.HasStyle
getClassName, getClassNames, getStyle, hasClassName
Methods inherited from interface com.vaadin.flow.component.HasText
getWhiteSpace, setWhiteSpace
-
Constructor Details
-
Text
Creates an instance using the given text.- Parameters:
text
- the text to show,null
is interpreted as an empty string
-
-
Method Details
-
setText
Sets the text of the component. -
getText
Gets the text of the component. -
set
Description copied from class:Component
Sets the value of the given component property. -
setId
The method is not supported for theText
class.Always throws an
UnsupportedOperationException
.- Overrides:
setId
in classComponent
- Parameters:
id
- the id to set, or""
to remove any previously set id- Throws:
UnsupportedOperationException
-
setVisible
public void setVisible(boolean visible) The method is not supported for theText
class.Always throws an
UnsupportedOperationException
.- Overrides:
setVisible
in classComponent
- Parameters:
visible
- the component visibility value- Throws:
UnsupportedOperationException
-
addClassName
The method is not supported for theText
class.Always throws an
UnsupportedOperationException
.- Specified by:
addClassName
in interfaceHasStyle
- Parameters:
className
- the CSS class name to add, notnull
- Throws:
UnsupportedOperationException
-
removeClassName
The method is not supported for theText
class.Always throws an
UnsupportedOperationException
.- Specified by:
removeClassName
in interfaceHasStyle
- Parameters:
className
- the CSS class name to remove, notnull
- Returns:
true
if the class name was removed,false
if the class list didn't contain the class name- Throws:
UnsupportedOperationException
-
setClassName
The method is not supported for theText
class.Always throws an
UnsupportedOperationException
.- Specified by:
setClassName
in interfaceHasStyle
- Parameters:
className
- a space-separated string of class names to set, ornull
to remove all class names- Throws:
UnsupportedOperationException
-
setClassName
The method is not supported for theText
class.Always throws an
UnsupportedOperationException
.- Specified by:
setClassName
in interfaceHasStyle
- Parameters:
className
- the class name to set or remove, notnull
set
-true
to set the class name,false
to remove it- Throws:
UnsupportedOperationException
-
addClassNames
The method is not supported for theText
class.Always throws an
UnsupportedOperationException
.- Specified by:
addClassNames
in interfaceHasStyle
- Parameters:
classNames
- the CSS class name or class names to be added to the component- Throws:
UnsupportedOperationException
-
removeClassNames
The method is not supported for theText
class.Always throws an
UnsupportedOperationException
.- Specified by:
removeClassNames
in interfaceHasStyle
- Parameters:
classNames
- the CSS class name or class names to be removed from the component- Throws:
UnsupportedOperationException
-