Class PropertyOutput<T>

java.lang.Object
com.vaadin.flow.component.trigger.AbstractOutput<T>
com.vaadin.flow.component.trigger.PropertyOutput<T>
Type Parameters:
T - the runtime type of the value produced
All Implemented Interfaces:
Output<T>, Serializable

public class PropertyOutput<T> extends AbstractOutput<T>
Reads a JavaScript property from a target element at the moment a trigger fires.

Common targets and properties:

  • TextField.valuenew PropertyOutput<>(textField, "value", String.class)
  • Checkbox.checkednew PropertyOutput<>(checkbox, "checked", Boolean.class)
See Also:
  • Field Details

  • Constructor Details

    • PropertyOutput

      public PropertyOutput(Element target, String propertyName, Class<T> valueType)
      Creates a property output that reads the given JS property from the given target element.
      Parameters:
      target - the element to read from, not null
      propertyName - the JS property name, not null
      valueType - runtime type of the produced value, not null
    • PropertyOutput

      public PropertyOutput(Component target, String propertyName, Class<T> valueType)
      Creates a property output that reads the given JS property from the given target component's root element.
      Parameters:
      target - the component to read from, not null
      propertyName - the JS property name, not null
      valueType - runtime type of the produced value, not null
  • Method Details

    • getTarget

      public Element getTarget()
      Returns:
      the target element
    • getPropertyName

      public String getPropertyName()
      Returns:
      the property name being read
    • buildClientConfig

      public tools.jackson.databind.node.ObjectNode buildClientConfig(ConfigContext context)
      Description copied from class: AbstractOutput
      Produces the JSON configuration this output sends to the client. Default is an empty object; override to add type-specific options.

      Subclasses encode element references by calling ConfigContext.referenceElement(com.vaadin.flow.dom.Element). Public so the internal framework can read the config without reflection; subclasses just override.

      Overrides:
      buildClientConfig in class AbstractOutput<T>
      Parameters:
      context - the resolver for referenced elements, not null
      Returns:
      a Jackson ObjectNode, never null