java.lang.Object
io.github.palexdev.materialfx.bindings.BiBindingBuilder<T>
Helper class for
BiBindingManager.
Makes the creation of bidirectional bindings easier with fluent methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate()Confirms the creation of the binding by callingBiBindingManager.apply(BiBindingBuilder, BiBindingHelper, boolean).BindingsMap<ObservableValue<? extends T>,BiConsumer<T, T>> booleanlazy()Disables the binding eager evaluation mechanism.override(boolean override) If a binding for the specified target is already present specifies if this builder's targetUpdater must replace the existing one.ObservableValue<? extends T>target()BiConsumer<T,T> final BiBindingBuilder<T>to(Map.Entry<ObservableValue<? extends T>, BiConsumer<T, T>>... sources) Allows adding multiple entries to the map at once.Callsto(ObservableValue, BiConsumer)with the given property.to(ObservableValue<T> source, BiConsumer<T, T> sourceUpdater) Adds a new entry in the map which associates the given source to the givenBiConsumerthat is responsible for updating the source when needed.with(BiConsumer<T, T> targetUpdater) Sets theBiConsumerfunction responsible for updating the target when the source changes.withHelper(BiBindingHelper<T> bindingHelper) Specifies theBiBindingHelperthat will be used for the binding.
-
Constructor Details
-
BiBindingBuilder
-
-
Method Details
-
with
Sets theBiConsumerfunction responsible for updating the target when the source changes. -
withHelper
Specifies theBiBindingHelperthat will be used for the binding.This is optional as a default helper will be created when needed.
-
to
Callsto(ObservableValue, BiConsumer)with the given property. Since it is aPropertytheBiConsumerwill make use ofWritableValue.setValue(Object). -
to
Adds a new entry in the map which associates the given source to the givenBiConsumerthat is responsible for updating the source when needed. -
to
@SafeVarargs public final BiBindingBuilder<T> to(Map.Entry<ObservableValue<? extends T>, BiConsumer<T, T>>... sources) Allows adding multiple entries to the map at once. Basically the same asto(ObservableValue, BiConsumer). -
lazy
Disables the binding eager evaluation mechanism. At the time of the binding the values won't be updated automatically. -
override
If a binding for the specified target is already present specifies if this builder's targetUpdater must replace the existing one. -
target
- Returns:
- the target observable
-
targetUpdater
- Returns:
- the target updater
-
getSources
- Returns:
- the map containing the sources and their updater
-
isEagerEvaluation
public boolean isEagerEvaluation()- Returns:
- if the bindings uses eager evaluation or it's lazy
-
create
Confirms the creation of the binding by callingBiBindingManager.apply(BiBindingBuilder, BiBindingHelper, boolean).
-