Interface ClassList

All Superinterfaces:
Collection<String>, Iterable<String>, Serializable, Set<String>
All Known Implementing Classes:
ImmutableClassList, OverlayClassListProxy

public interface ClassList extends Set<String>, Serializable
Representation of the class names for an Element.
Since:
1.0
Author:
Vaadin Ltd
  • Method Details

    • set

      default boolean set(String className, boolean set)
      Sets or removes the given class name, based on the set parameter.
      Parameters:
      className - the class name to set or remove
      set - true to set the class name, false to remove it
      Returns:
      true if the class list was modified (class name added or removed), false otherwise
    • bind

      default void bind(String name, Signal<Boolean> signal)
      Binds the presence of the given class name to the provided signal so that the class is added when the signal value is true and removed when the value is false.

      Passing null as the signal removes any existing binding for the given class name. When unbinding, the current presence of the class is left unchanged.

      While a binding for the given class name is active, manual calls to Set.add(Object), Set.remove(Object) or set(String, boolean) for that name will throw a com.vaadin.flow.dom.BindingActiveException. Bindings are lifecycle-aware and only active while the owning Element is in attached state; they are deactivated while the element is in detached state.

      Bulk operations that indiscriminately replace or clear the class list (for example Set.clear() or setting the class attribute via Element.setAttribute(String, String)) clear all bindings.

      Parameters:
      name - the class name to bind, not null or blank
      signal - the boolean signal to bind to, or null to unbind
      Throws:
      BindingActiveException - thrown when there is already an existing binding
      Since:
      25.0