public interface HasStyle extends HasElement
Component
which has class attribute and inline styles.Modifier and Type | Method and Description |
---|---|
default void |
addClassName(String className)
Adds a CSS class name to this component.
|
default void |
addClassNames(String... classNames)
Adds one or more CSS class names to this component.
|
default String |
getClassName()
Gets the CSS class names for this component.
|
default ClassList |
getClassNames()
Gets the set of CSS class names used for this element.
|
default Style |
getStyle()
Gets the style instance for managing inline styles for the element of
this component.
|
default boolean |
hasClassName(String className)
Checks if the component has the given class name.
|
default boolean |
removeClassName(String className)
Removes a CSS class name from this component.
|
default void |
removeClassNames(String... classNames)
Removes one or more CSS class names from component.
|
default void |
setClassName(String className)
Sets the CSS class names of this component.
|
default void |
setClassName(String className,
boolean set)
Sets or removes the given class name for this component.
|
getElement
default void addClassName(String className)
className
- the CSS class name to add, not null
default boolean removeClassName(String className)
className
- the CSS class name to remove, not null
true
if the class name was removed,
false
if the class list didn't contain the class
namedefault void setClassName(String className)
className
- a space-separated string of class names to set, or
null
to remove all class namesdefault String getClassName()
null
if
there are no class namesdefault ClassList getClassNames()
class
attribute.
Despite the name implying a list being returned, the return type is
actually a Set
since the in-browser return value behaves like a
Set
in Java.
null
Element.getClassList()
default void setClassName(String className, boolean set)
className
- the class name to set or remove, not null
set
- true
to set the class name, false
to
remove itdefault boolean hasClassName(String className)
className
- the class name to check fortrue
if the component has the given class name,
false
otherwisedefault Style getStyle()
null
default void addClassNames(String... classNames)
classNames
- the CSS class name or class names to be added to the componentdefault void removeClassNames(String... classNames)
classNames
- the CSS class name or class names to be removed from the componentCopyright © 2023. All rights reserved.