Package com.dua3.utility.fx.controls
Class FileInputBuilder
java.lang.Object
com.dua3.utility.fx.controls.InputControlBuilder<FileInputBuilder,Path>
com.dua3.utility.fx.controls.FileInputBuilder
Builder for creating instances of
FileInput with customizable options.
The builder provides methods to configure the file dialog mode, initial path,
extension filters, validation, and disabled state.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aFileInputobject using the properties specified in theFileInputBuilder.Sets the 'disabled' property for the FileInput control.existingOnly(boolean flag) Sets the flag indicating whether only existing files or directories should be selectable.filter(javafx.stage.FileChooser.ExtensionFilter... filter) Adds the specified file extension filters to the FileChooser.Sets the validation function for the file input.Methods inherited from class com.dua3.utility.fx.controls.InputControlBuilder
applyTo, getDefault, getOnChangeListeners, onChange, self, setDefault, setDefault
-
Method Details
-
disabled
Sets the 'disabled' property for the FileInput control.- Parameters:
disabled- an ObservableValue object representing the disabled state of the FileInput control- Returns:
- the current instance of FileInputBuilder with the 'disabled' property set
-
validate
Sets the validation function for the file input.- Parameters:
validate- a function that takes a Path and returns an Optional containing an error message if validation fails, or an empty Optional if validation succeeds- Returns:
- the updated FileInputBuilder instance
-
filter
Adds the specified file extension filters to the FileChooser.- Parameters:
filter- One or more FileChooser.ExtensionFilter objects representing the file extension filters to be added.- Returns:
- The current instance of FileInputBuilder, allowing for method chaining.
-
existingOnly
Sets the flag indicating whether only existing files or directories should be selectable.- Parameters:
flag- a boolean flag; if true, only existing files or directories can be selected, otherwise new ones can also be selected- Returns:
- the current instance of FileInputBuilder for method chaining
-
build
Builds aFileInputobject using the properties specified in theFileInputBuilder.- Specified by:
buildin classInputControlBuilder<FileInputBuilder,Path> - Returns:
- a constructed
FileInputcontrol based on the current configuration.
-