Interface HasStyle

    • Method Detail

      • addClassName

        default void addClassName​(String className)
        Adds a CSS class name to this component.
        Parameters:
        className - the CSS class name to add, not null
      • removeClassName

        default boolean removeClassName​(String className)
        Removes a CSS class name from this component.
        Parameters:
        className - the CSS class name to remove, not null
        Returns:
        true if the class name was removed, false if the class list didn't contain the class name
      • setClassName

        default void setClassName​(String className)
        Sets the CSS class names of this component. This method overwrites any previous set class names.
        Parameters:
        className - a space-separated string of class names to set, or null to remove all class names
      • getClassName

        default String getClassName()
        Gets the CSS class names for this component.
        Returns:
        a space-separated string of class names, or null if there are no class names
      • getClassNames

        default ClassList getClassNames()
        Gets the set of CSS class names used for this element. The returned set can be modified to add or remove class names. The contents of the set is also reflected in the value of the 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.

        Returns:
        a list of class names, never null
        See Also:
        Element.getClassList()
      • setClassName

        default void setClassName​(String className,
                                  boolean set)
        Sets or removes the given class name for this component.
        Parameters:
        className - the class name to set or remove, not null
        set - true to set the class name, false to remove it
      • hasClassName

        default boolean hasClassName​(String className)
        Checks if the component has the given class name.
        Parameters:
        className - the class name to check for
        Returns:
        true if the component has the given class name, false otherwise
      • getStyle

        default Style getStyle()
        Gets the style instance for managing inline styles for the element of this component.
        Returns:
        the style object for the element, not null
      • addClassNames

        default void addClassNames​(String... classNames)
        Adds one or more CSS class names to this component. Multiple class names can be specified by using spaces or by giving multiple parameters.
        Parameters:
        classNames - the CSS class name or class names to be added to the component
      • removeClassNames

        default void removeClassNames​(String... classNames)
        Removes one or more CSS class names from component. Multiple class names can be specified by using spaces or by giving multiple parameters.
        Parameters:
        classNames - the CSS class name or class names to be removed from the component