public interface HasStyleNames extends Serializable
Each style name will occur only once as specified and it is not prefixed with the style name of the component.
Modifier and Type | Method and Description |
---|---|
void |
addStyleName(String style)
Adds one or more style names to this component.
|
default void |
addStyleNames(String... styles)
Adds one or more style names to this component by using one or multiple
parameters.
|
String |
getStyleName()
Gets all user-defined CSS style names of a component.
|
void |
removeStyleName(String style)
Removes one or more style names from component.
|
default void |
removeStyleNames(String... styles)
Removes one or more style names from component.
|
void |
setStyleName(String style)
Sets one or more user-defined style names of the component, replacing any
previous user-defined styles.
|
default void |
setStyleName(String style,
boolean add)
Adds or removes a style name.
|
String getStyleName()
The style names are returned only in the basic form in which they were added.
setStyleName(String)
,
addStyleName(String)
,
removeStyleName(String)
void setStyleName(String style)
It is normally a good practice to use addStyleName()
rather than this setter, as different software
abstraction layers can then add their own styles without accidentally
removing those defined in other layers.
style
- the new style or styles of the component as a space-separated
listgetStyleName()
,
addStyleName(String)
,
removeStyleName(String)
default void setStyleName(String style, boolean add)
add
parameter is true, the style name is added to the
component. If the add
parameter is false, the style name is
removed from the component.
Functionally this is equivalent to using addStyleName(String)
or
removeStyleName(String)
style
- the style name to be added or removedadd
- true
to add the given style, false
to remove itaddStyleName(String)
,
removeStyleName(String)
void addStyleName(String style)
style
- the new style to be added to the componentgetStyleName()
,
setStyleName(String)
,
removeStyleName(String)
default void addStyleNames(String... styles)
styles
- the style name or style names to be added to the componentaddStyleName(String)
,
setStyleName(String)
,
removeStyleName(String)
void removeStyleName(String style)
The parameter must be a valid CSS style name. Only user-defined style
names added with addStyleName()
or
setStyleName()
can be removed; built-in
style names defined in Vaadin or GWT can not be removed.
style
- the style name or style names to be removedgetStyleName()
,
setStyleName(String)
,
addStyleName(String)
default void removeStyleNames(String... styles)
The parameter must be a valid CSS style name. Only user-defined style
names added with addStyleName()
or
setStyleName()
can be removed; built-in
style names defined in Vaadin or GWT can not be removed.
styles
- the style name or style names to be removedremoveStyleName(String)
,
setStyleName(String)
,
addStyleName(String)
Copyright © 2019 Vaadin Ltd. All rights reserved.