Interface Style

All Superinterfaces:
Serializable
All Known Implementing Classes:
BasicElementStyle, ImmutableEmptyStyle

public interface Style extends Serializable
Provides inline styles for Elements.
Since:
1.0
Author:
Vaadin Ltd
  • Method Summary

    Modifier and Type
    Method
    Description
    Removes all set style properties.
    get(String name)
    Gets the value of the given style property.
    Gets the defined style property names.
    boolean
    has(String name)
    Checks if the given style property has been set.
    remove(String name)
    Removes the given style property if it has been set.
    set(String name, String value)
    Sets the given style property to the given value.
  • Method Details

    • get

      String get(String name)
      Gets the value of the given style property.

      Note that the name should be in camelCase and not dash-separated, i.e. use "fontFamily" and not "font-family"

      Parameters:
      name - the style property name as camelCase, not null
      Returns:
      the style property value, or null if the style property has not been set
    • set

      Style set(String name, String value)
      Sets the given style property to the given value.

      Both camelCased (e.g. fontFamily) and dash-separated (e.g. font-family versions are supported.

      Parameters:
      name - the style property name as camelCase, not null
      value - the style property value (if null, the property will be removed)
      Returns:
      this style instance
    • remove

      Style remove(String name)
      Removes the given style property if it has been set.

      Both camelCased (e.g. fontFamily) and dash-separated (e.g. font-family versions are supported.

      Parameters:
      name - the style property name as camelCase, not null
      Returns:
      this style instance
    • clear

      Style clear()
      Removes all set style properties.
      Returns:
      this style instance
    • has

      boolean has(String name)
      Checks if the given style property has been set.

      Both camelCased (e.g. fontFamily) and dash-separated (e.g. font-family versions are supported.

      Parameters:
      name - the style property name as camelCase, not null
      Returns:
      true if the style property has been set, false otherwise
    • getNames

      Stream<String> getNames()
      Gets the defined style property names.

      Note that this always returns the name as camelCased, e.g. fontFamily even if it has been set as dash-separated (font-family).

      Returns:
      a stream of defined style property names