Interface ComponentValueBuilder<T,C extends JComponent,B extends ComponentValueBuilder<T,C,B>>

Type Parameters:
T - the type of the value the component represents
C - the component type
B - the builder type
All Superinterfaces:
ComponentBuilder<C,B>, Supplier<C>
All Known Subinterfaces:
ButtonBuilder<T,C,B>, CheckBoxBuilder, CheckBoxMenuItemBuilder<B>, ComboBoxBuilder<T,C,B>, EntityComboBox.Builder, EntityComboBoxPanel.Builder, EntitySearchField.Builder<T,B>, EntitySearchField.MultiSelectionBuilder, EntitySearchField.SingleSelectionBuilder, EntitySearchFieldPanel.Builder<T,B>, EntitySearchFieldPanel.MultiSelectionBuilder, EntitySearchFieldPanel.SingleSelectionBuilder, FileInputPanel.Builder<T>, ItemComboBoxBuilder<T>, ItemSpinnerBuilder<T>, LabelBuilder<T>, ListBoxBuilder<T>, ListBuilder<T,V,B>, ListBuilder.Items<T>, ListBuilder.SelectedItem<T>, ListBuilder.SelectedItems<T>, ListSpinnerBuilder<T>, MaskedTextFieldBuilder, MenuItemBuilder<C,B>, NumberField.Builder<T>, NumberSpinnerBuilder<T>, PasswordFieldBuilder, ProgressBarBuilder, RadioButtonBuilder, RadioButtonMenuItemBuilder<B>, SliderBuilder, SpinnerBuilder<T,B>, TemporalField.Builder<T>, TemporalFieldPanel.Builder<T>, TextAreaBuilder, TextComponentBuilder<T,C,B>, TextFieldBuilder<T,C,B>, TextFieldPanel.Builder, TextPaneBuilder, ToggleButtonBuilder<C,B>, ToggleMenuItemBuilder<C,B>
All Known Implementing Classes:
AbstractComponentValueBuilder, DefaultComboBoxBuilder

public interface ComponentValueBuilder<T,C extends JComponent,B extends ComponentValueBuilder<T,C,B>> extends ComponentBuilder<C,B>, Supplier<C>
Use ComponentBuilder.build() to build a JComponent instance or buildValue() to build a ComponentValue instance.
The component is available via ComponentValue.component() and the associated ComponentValue instance is available via the COMPONENT_VALUE client property.
  • Field Details

  • Method Details

    • value

      B value(@Nullable T value)
      Sets the initial value for the component, unless value(s) have been linked via link(Value) or link(Observable), which then control the inital value. The initial value is set before any listeners are added, so no events are triggered.
      Parameters:
      value - the initial value
      Returns:
      this builder instance
    • modifiedIndicator

      B modifiedIndicator(@Nullable ObservableState modified)
      Enables a modified indicator based on the given modified state.
      Parameters:
      modified - the modified state
      Returns:
      this builder instance
      See Also:
    • validIndicatorFactory

      B validIndicatorFactory(@Nullable ValidIndicatorFactory validIndicatorFactory)
      Parameters:
      validIndicatorFactory - the ValidIndicatorFactory to use, null for none
      Returns:
      this builder instance
      See Also:
    • validIndicator

      B validIndicator(@Nullable ObservableState valid)
      Enables a valid indicator based on the given valid state.
      Parameters:
      valid - the valid state
      Returns:
      this builder instance
      See Also:
    • validIndicator

      B validIndicator(@Nullable Predicate<T> validator)

      Enables a valid indicator based on the given validator. Note that this is overridden by validIndicator(ObservableState).

      The validator gets called each time the value changes and should return true as long as the value is valid.

      Parameters:
      validator - called each time the component value changes
      Returns:
      this builder instance
      See Also:
    • modifiedIndicatorFactory

      B modifiedIndicatorFactory(@Nullable ModifiedIndicatorFactory modifiedIndicatorFactory)
      Parameters:
      modifiedIndicatorFactory - the ModifiedIndicatorFactory to use, null for none
      Returns:
      this builder instance
    • validator

      B validator(Value.Validator<T> validator)
      Parameters:
      validator - the validator to use
      Returns:
      this builder instance
    • link

      B link(Value<T> linkedValue)
      Creates a bidirectional link to the given value. Overrides any initial value set.
      Parameters:
      linkedValue - a value to link to the component value
      Returns:
      this builder instance
    • link

      B link(Observable<T> linkedValue)
      Creates a read-only link to the given Observable.
      Parameters:
      linkedValue - a value to link to the component value
      Returns:
      this builder instance
    • listener

      B listener(Runnable listener)
      Parameters:
      listener - a listener to add to the resulting component value
      Returns:
      this builder instance
    • consumer

      B consumer(Consumer<T> consumer)
      Parameters:
      consumer - a consumer to add to the resulting component value
      Returns:
      this builder instance
    • onBuildValue

      B onBuildValue(Consumer<ComponentValue<T,C>> onBuildValue)
      Parameters:
      onBuildValue - called when the component value has been built.
      Returns:
      this builder instance
    • buildValue

      ComponentValue<T,C> buildValue()
      Builds and returns the component value.
      Returns:
      the component value
    • buildValue

      Builds and returns the component value.
      Parameters:
      onBuild - called after the component value is built.
      Returns:
      the component value