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 ToggleGroupBuilderaddToggles(Collection<? extends Toggle> col) Calls theaddAllmethod on the ObservableList returned by theToggleGroup#getToggles()method.final ToggleGroupBuilderaddToggles(Toggle... elements) Calls theaddAllmethod 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 theToggleGroupclass.static ToggleGroupBuildercreate()Returns an instance of theToggleGroupBuilder.Applies a function to theselectedTogglePropertyof the instance being constructed.A builder method that invokes thesetUserDatamethod on the instance being constructed.static ToggleGroupBuilderwithToggles(Collection<? extends Toggle> col) Creates an instance of the builder, then calls theaddAllmethod on the ObservableList returned by theToggleGroup#getToggles()method.static ToggleGroupBuilderwithToggles(Toggle... elements) Creates an instance of the builder, then calls theaddAllmethod 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 theToggleGroupclass.Intermediate builder methods are not evaluated until the
buildmethod is called; in other words, they are evaluated lazily.- Returns:
- new instance of the
ToggleGroupclass
-
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 thesetUserDatamethod on the instance being constructed.- Returns:
- builder instance
-
addToggles
Calls theaddAllmethod on the ObservableList returned by theToggleGroup#getToggles()method.- Returns:
- builder instance
-
addToggles
Calls theaddAllmethod on the ObservableList returned by theToggleGroup#getToggles()method.- Returns:
- builder instance
-
withToggles
Creates an instance of the builder, then calls theaddAllmethod on the ObservableList returned by theToggleGroup#getToggles()method.- Returns:
- builder instance
-
withToggles
Creates an instance of the builder, then calls theaddAllmethod on the ObservableList returned by theToggleGroup#getToggles()method.- Returns:
- builder instance
-
selectedTogglePropertyApply
Applies a function to theselectedTogglePropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.selectedToggleProperty().bind(anotherProperty)) // Use shorthand form .selectedTogglePropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-