Class ToggleGroupBuilder
java.lang.Object
io.github.sosuisen.jfxbuilder.controls.ToggleGroupBuilder
The
ToggleGroupBuilder
class constructs instances of the ToggleGroup
class
and offers a fluent interface for creating and configuring it.
This class includes a static create
method that accepts the same arguments as the original ToggleGroup
constructor
and returns an instance of the ToggleGroupBuilder
.
You can use method chaining to call the builder methods for configuring the ToggleGroup
.
Finally, invoke the build
method to generate an instance of the ToggleGroup
class.
Note that intermediate builder methods are not evaluated until the build
method
is called, meaning they are evaluated lazily.
- Author:
- Hidekazu Kubota <hidekazu.kubota@gmail.com>
-
Method Summary
Modifier and TypeMethodDescriptionfinal ToggleGroupBuilder
addToggles
(Collection<? extends Toggle> col) Calls theaddAll
method on the ObservableList returned by theToggleGroup#getToggles()
method.final ToggleGroupBuilder
addToggles
(Toggle... elements) Calls theaddAll
method on the ObservableList returned by theToggleGroup#getToggles()
method.apply
(Consumer<ToggleGroup> func) Applies a function to the ToggleGroup instance being constructed.build()
Builds and returns an instance of theToggleGroup
class.static ToggleGroupBuilder
create()
Returns an instance of theToggleGroupBuilder
.Applies a function to theselectedToggleProperty
of the instance being constructed.A builder method that invokes thesetUserData
method on the instance being constructed.static ToggleGroupBuilder
withToggles
(Collection<? extends Toggle> col) Creates an instance of the builder, then calls theaddAll
method on the ObservableList returned by theToggleGroup#getToggles()
method.static ToggleGroupBuilder
withToggles
(Toggle... elements) Creates an instance of the builder, then calls theaddAll
method on the ObservableList returned by theToggleGroup#getToggles()
method.
-
Method Details
-
create
Returns an instance of theToggleGroupBuilder
.- Returns:
- an instance of the
ToggleGroupBuilder
.
-
build
Builds and returns an instance of theToggleGroup
class.Intermediate builder methods are not evaluated until the
build
method is called; in other words, they are evaluated lazily.- Returns:
- new instance of the
ToggleGroup
class
-
apply
Applies a function to the ToggleGroup instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
userData
A builder method that invokes thesetUserData
method on the instance being constructed.- Returns:
- builder instance
-
addToggles
Calls theaddAll
method on the ObservableList returned by theToggleGroup#getToggles()
method.- Returns:
- builder instance
-
addToggles
Calls theaddAll
method on the ObservableList returned by theToggleGroup#getToggles()
method.- Returns:
- builder instance
-
withToggles
Creates an instance of the builder, then calls theaddAll
method on the ObservableList returned by theToggleGroup#getToggles()
method.- Returns:
- builder instance
-
withToggles
Creates an instance of the builder, then calls theaddAll
method on the ObservableList returned by theToggleGroup#getToggles()
method.- Returns:
- builder instance
-
selectedTogglePropertyApply
Applies a function to theselectedToggleProperty
of the instance being constructed. This serves as a shorthand form of theapply
method.Example:
// Use apply .apply(obj -> obj.selectedToggleProperty().bind(anotherProperty)) // Use shorthand form .selectedTogglePropertyApply(prop -> prop.bind(anotherProperty))
- Returns:
- builder instance
-