Class PropertyInput<T>

java.lang.Object
com.vaadin.flow.component.trigger.internal.Action.Input<T>
com.vaadin.flow.component.trigger.internal.PropertyInput<T>
Type Parameters:
T - the runtime type of the value produced
All Implemented Interfaces:
Serializable

public class PropertyInput<T> extends Action.Input<T>
Reads a JavaScript property from a target component's root element at the moment a trigger fires.

Common targets and properties:

  • TextField.value ? new PropertyInput<>(textField, "value", String.class)
  • Checkbox.checked ? new PropertyInput<>(checkbox, "checked", Boolean.class)

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

Since:
25.2
See Also:
  • Constructor Details

    • PropertyInput

      public PropertyInput(Component target, String propertyName, Class<T> valueType)
      Creates a property input that reads the given JS property from the given target component.
      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

    • toJs

      public JsFunction toJs(Trigger trigger)
      Description copied from class: Action.Input
      Builds the JsFunction that yields this input's value when called. The function may take event as a runtime argument (declared by the subclass via JsFunction.withArguments(String...)); inputs that don't need event simply omit the declaration and ignore the argument the caller passes.

      Public so that Action implementations in any package can consume inputs they receive as parameters, not only inputs they created themselves.

      Specified by:
      toJs in class Action.Input<T>
      Parameters:
      trigger - the surrounding trigger this render is for, not null
      Returns:
      the input's JS function, not null