Klasse NodeBuilder<N extends Node,NN extends NodeBuilder<N,NN>>
java.lang.Object
com.dua3.utility.fx.controls.abstract_builders.NodeBuilder<N,NN>
- Typparameter:
N- the type of node to be builtNN- the type of the concrete builder
- Bekannte direkte Unterklassen:
ControlBuilder,ShapeBuilder
An abstract base class for building nodes, providing a fluent API for configuring and creating instances
of the node type specified by the generic parameter
N.-
Konstruktorübersicht
KonstruktorenModifiziererKonstruktorBeschreibungprotectedNodeBuilder(Supplier<? extends N> factory) Constructs a new instance of the NodeBuilder class using the specified factory. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected final <T> voidApplies a value to the provided consumer if the value is not null.protected final <T> voidapply(@Nullable ObservableValue<? extends T> value, Property<? super T> property) Binds the givenObservableValueto the specifiedProperty.bindDisabled(ObservableValue<Boolean> disabled) Bind the node's disabled state to anObservableValue.bindEnabled(ObservableValue<Boolean> enabled) Bind the button's enabled state to anObservableValue.build()Builds and returns a new instance of the node type specified by the builder.disabled(boolean disabled) Set the node's disabled state to the supplied value.prefHeight(double height) Sets the preferred height of the node being built.prefSize(double width, double height) Sets the preferred width and height for the node being built.prefWidth(double width) Sets the preferred width for the node being built.protected final NNself()Returns the current instance of the builder with the proper type.
-
Konstruktordetails
-
NodeBuilder
Constructs a new instance of the NodeBuilder class using the specified factory.- Parameter:
factory- the supplier that provides a new instance of the node type to be built
-
-
Methodendetails
-
self
Returns the current instance of the builder with the proper type.- Gibt zurück:
- this instance of the builder
-
apply
Applies a value to the provided consumer if the value is not null.- Typparameter:
T- the type of the value to apply- Parameter:
value- the value to be applied; can be nullsetter- the consumer to which the value is applied if not null
-
apply
protected final <T> void apply(@Nullable ObservableValue<? extends T> value, Property<? super T> property) Binds the givenObservableValueto the specifiedProperty.This method ensures that the property is dynamically updated to reflect the value of the
ObservableValue, if it is not null.- Typparameter:
T- the type of the value to be bound- Parameter:
value- theObservableValueto be bound to the property; may be nullproperty- thePropertyto bind the observable value to
-
build
Builds and returns a new instance of the node type specified by the builder.Derived classes should always call
super.build()to get an instance and then apply the added configuration.- Gibt zurück:
- a new instance of the node created by the factory associated with this builder
-
disabled
Set the node's disabled state to the supplied value.NOTE: Do not use together with
bindEnabled(ObservableValue)andbindDisabled(ObservableValue).- Parameter:
disabled- the value to bind the node's disableProperty to- Gibt zurück:
- this NodeBuilder instance
-
bindDisabled
Bind the node's disabled state to anObservableValue.NOTE: Use either this method or
bindEnabled(ObservableValue), not both.- Parameter:
disabled- the value to bind the node's disableProperty to- Gibt zurück:
- this NodeBuilder instance
-
bindEnabled
Bind the button's enabled state to anObservableValue.NOTE: Use either this method or
bindDisabled(ObservableValue), not both.- Parameter:
enabled- the value to bind the button's disableProperty to- Gibt zurück:
- this NodeBuilder instance
-
prefWidth
Sets the preferred width for the node being built.- Parameter:
width- the preferred width to set for the node- Gibt zurück:
- this instance of the builder
-
prefHeight
Sets the preferred height of the node being built.- Parameter:
height- the preferred height to set- Gibt zurück:
- this instance of the builder
-
prefSize
Sets the preferred width and height for the node being built.- Parameter:
width- the preferred width to set for the nodeheight- the preferred height to set for the node- Gibt zurück:
- this instance of the builder
-