Class ElementAttributeMap

All Implemented Interfaces:
Serializable

public class ElementAttributeMap extends NodeMap
Map for element attribute values.

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

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

    • ElementAttributeMap

      public ElementAttributeMap(StateNode node)
      Creates a new element attribute map for the given node.
      Parameters:
      node - the node that the map belongs to
  • Method Details

    • set

      public void set(String attribute, String value)
      Sets the given attribute to the given value.
      Parameters:
      attribute - the attribute name
      value - the value
    • bindSignal

      public SignalBinding<String> bindSignal(Element owner, String attribute, Signal<String> signal)
      Binds the given signal to the given attribute. null signal
      Parameters:
      owner - the element owning the attribute, not null
      attribute - the name of the attribute
      signal - the signal to bind, not null
      Returns:
      the binding, which can be used to react to updates
      Throws:
      BindingActiveException - thrown when there is already an existing binding for the given attribute
      Since:
      25.0
    • bindBooleanSignal

      public SignalBinding<Boolean> bindBooleanSignal(Element owner, String attribute, Signal<Boolean> signal)
      Binds the given signal to the presence of the given attribute. The attribute is set to an empty value while the signal value is true and removed while it is false.
      Parameters:
      owner - the element owning the attribute, not null
      attribute - the name of the attribute
      signal - the signal to bind, not null
      Returns:
      the created binding
      Throws:
      BindingActiveException - thrown when there is already an existing binding for the given attribute
      Since:
      25.4
    • has

      public boolean has(String attribute)
      Checks whether an attribute with the given name has been set.
      Parameters:
      attribute - the name of the attribute
      Returns:
      true if there is a property with the given name; false if there is no property
    • remove

      public Serializable remove(String attribute)
      Removes the named attribute.
      Overrides:
      remove in class NodeMap
      Parameters:
      attribute - the name of the attribute to remove
      Returns:
      the removed value, null if no value was removed
    • get

      public String get(String attribute)
      Gets the value of an attribute.
      Overrides:
      get in class NodeMap
      Parameters:
      attribute - the name of the property
      Returns:
      the attribute value or null if the attribute has not been set
    • attributes

      public Stream<String> attributes()
      Gets the attribute names.
      Returns:
      a stream of all the attribute names which have been set
    • setResource

      public void setResource(String attribute, AbstractStreamResource resource)
      Sets the given attribute to the given StreamResource value.
      Parameters:
      attribute - the attribute name
      resource - the value