Skip to content

Commit

Permalink
small bindings fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xzel23 committed Dec 6, 2024
1 parent 2779eff commit df71f9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import javafx.beans.value.ObservableNumberValue;
import javafx.geometry.Orientation;
import javafx.scene.Node;
import org.jspecify.annotations.Nullable;

import java.util.function.BiFunction;
import java.util.function.DoubleConsumer;
Expand Down Expand Up @@ -152,24 +151,13 @@ public SliderBuilder onChange(DoubleConsumer onChange) {
return this;
}

/**
* Binds the slider's value property to the specified observable number value.
*
* @param value the observable number value to which the slider's value property should be bound
* @return this instance of {@code SliderBuilder} for method chaining.
*/
public SliderBuilder bind(ObservableNumberValue value) {
slider.valueProperty().bind(value);
return this;
}

/**
* Binds the slider's value property bidirectionally with the specified number property.
*
* @param value the property to be bound bidirectionally with the slider's value property.
* @return this instance of {@code SliderBuilder} for method chaining.
*/
public SliderBuilder bindBidirectional(Property<@Nullable Number> value) {
public SliderBuilder bind(Property<Number> value) {
slider.valueProperty().bindBidirectional(value);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public TextFieldBuilder type(TextFieldType type) {
* @return this instance
*/
public TextFieldBuilder bindDisabled(ObservableBooleanValue disabled) {
if (this.disabled != null) {
throw new IllegalStateException("the disabled property has already been bound to a value");
}
this.disabled = disabled;
return this;
}
Expand Down

0 comments on commit df71f9e

Please sign in to comment.