Class ImmutableEmptyStyle

java.lang.Object
com.vaadin.flow.dom.impl.ImmutableEmptyStyle
All Implemented Interfaces:
Style, Serializable

public class ImmutableEmptyStyle extends Object implements Style
A style implementation which is empty and immutable.

For internal use only. May be renamed or removed in a future release.

Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • ImmutableEmptyStyle

      public ImmutableEmptyStyle()
  • Method Details

    • get

      public String get(String name)
      Description copied from interface: Style
      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".

      When a style property is bound to a signal with Style.bind(String, Signal), this method returns the value of the latest signal applied for the given style property name while the element was in the attached state.

      Specified by:
      get in interface Style
      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
      See Also:
    • set

      public Style set(String name, String value)
      Description copied from interface: Style
      Sets the given style property to the given value.

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

      While a signal binding for a specific style name is active, any attempt to manually set that same style throws a BindingActiveException.

      Specified by:
      set in interface Style
      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
      See Also:
    • remove

      public Style remove(String name)
      Description copied from interface: Style
      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.

      While a signal binding for a specific style name is active, any attempt to manually remove that same style throws a BindingActiveException.

      Specified by:
      remove in interface Style
      Parameters:
      name - the style property name as camelCase, not null
      Returns:
      this style instance
      See Also:
    • clear

      public Style clear()
      Description copied from interface: Style
      Removes all set style properties.

      This method silently clears all style signal bindings (unsubscribe and forget recorded values) in addition to clearing style values.

      Specified by:
      clear in interface Style
      Returns:
      this style instance
      See Also:
    • has

      public boolean has(String name)
      Description copied from interface: Style
      Checks if the given style property has been set.

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

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

      public Stream<String> getNames()
      Description copied from interface: Style
      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).

      Includes names of the style properties bound with the signals while the element was in the attached state.

      Specified by:
      getNames in interface Style
      Returns:
      a stream of defined style property names
      See Also:
    • bind

      public Style bind(String name, Signal<String> signal)
      Binds the given style property to the provided string signal and keeps the style property value synchronized with the signal.

      When a binding is in place, the style signal mirrors signal.get(). If the signal value is null, the style property is removed; otherwise it is set to the string value.

      The binding effect is active only while the owner element is in the attached state. While the owner is in the detached state, updates from the signal have no effect.

      While a binding for a specific style name is active, any attempt to bind another signal for the same name throws a BindingActiveException.

      Name handling follows the same rules as Style.set(String, String): both camelCase and dash-separated names are supported and normalized in the same way.

      Immutable style implementation does not support binding a Signal to a style property,

      Specified by:
      bind in interface Style
      Parameters:
      name - the style property name, not null
      signal - the signal that provides the style value, not null
      Returns:
      this style instance
      See Also: