Class SliderValueBinding<V>

java.lang.Object
io.jmix.flowui.data.binding.impl.AbstractValueBinding<V>
io.jmix.flowui.data.binding.impl.SliderValueBinding<V>
Type Parameters:
V - the value type
All Implemented Interfaces:
JmixBinding, SuspendableBinding, ValueBinding<V>

@Component("flowui_SliderValueBinding") @Scope("prototype") public class SliderValueBinding<V> extends AbstractValueBinding<V>
Implementation of ValueBinding for working with slider components.

A slider cannot represent an absent value and falls back to its minimum value, so the fallback is not propagated to the value source.

  • Field Details

    • componentValueSetHandler

      protected Runnable componentValueSetHandler
  • Constructor Details

    • SliderValueBinding

      public SliderValueBinding(ValueSource<V> valueSource, com.vaadin.flow.component.HasValue<?,V> component)
  • Method Details

    • setComponentValueSetHandler

      public void setComponentValueSetHandler(@Nullable Runnable componentValueSetHandler)
      Sets a handler invoked after a value source value has been set to the component.

      The component substitutes an absent value with its minimum value, so a value source value can change the empty state of the component without changing the component value, i.e. without firing a value change event.

      Parameters:
      componentValueSetHandler - the handler to set, or null to remove it
    • onComponentValueChange

      protected void onComponentValueChange()
      Overrides:
      onComponentValueChange in class AbstractValueBinding<V>
    • writeComponentValueToSource

      public void writeComponentValueToSource()
      Writes the current component value to the value source.

      The component cannot represent an absent value and shows its minimum value instead, so setting the value the component already shows fires no value change event, and the binding has nothing to react to, although the value source value becomes present.

    • clearValue

      public void clearValue(Runnable clearComponentValueAction)
      Clears the value of the component and of the value source.

      The component cannot represent an absent value and falls back to its minimum value, so the propagation to the value source is suspended while the component is being cleared and the value source receives null instead of that fallback.

      Parameters:
      clearComponentValueAction - action that clears the component value
    • getComponentValue

      protected @Nullable V getComponentValue()
      Specified by:
      getComponentValue in class AbstractValueBinding<V>
    • setComponentValue

      protected void setComponentValue(@Nullable V value)
      Specified by:
      setComponentValue in class AbstractValueBinding<V>