java.lang.Object
com.dua3.utility.fx.controls.FileChooserBuilder
Builder for file open/save dialogs.
Provides a fluent interface to create file dialogs.
-
Method Summary
Modifier and TypeMethodDescriptionAdd filter to the list of filters.filter(Collection<FileChooser.ExtensionFilter> filters) Set filters.filter(FileChooser.ExtensionFilter... filters) Set filters.initialDir(@Nullable Path initialDir) Set initial directory.initialFile(Path file) Set initial filename and directory.initialFileName(@Nullable String initialFileName) Set initial filename.selectedFilter(@Nullable FileChooser.ExtensionFilter f) Set selected filter.showOpenDialog(@Nullable Window parent) Show "Open" dialog.showOpenMultipleDialog(@Nullable Window parent) Show "Open multiple" dialog.showSaveDialog(@Nullable Window parent) Show "Save" dialog.
-
Method Details
-
showOpenDialog
Show "Open" dialog.- Parameters:
parent- the parent window- Returns:
- an Optional containing the selected file.
-
showOpenMultipleDialog
Show "Open multiple" dialog.- Parameters:
parent- the parent window- Returns:
- a List containing the selected files, or an empty list if no files were selected
-
showSaveDialog
Show "Save" dialog.- Parameters:
parent- the parent window- Returns:
- an Optional containing the selected file.
-
initialFile
Set initial filename and directory.- Parameters:
file- the file- Returns:
- this instance
-
initialFileName
Set initial filename.- Parameters:
initialFileName- the initial filename- Returns:
- this instance
-
initialDir
Set initial directory. If the initial directory is inaccessible or non-existent, it will be ignored when creating the dialog. If it exists, but is a regular file, the dialog will be created with the file's parent directory set as its initial directory.- Parameters:
initialDir- the initial directory- Returns:
- this instance
-
addFilter
Add filter to the list of filters.- Parameters:
name- the filter namepattern- the pattern(s) to use for this filter- Returns:
- this instance
-
filter
Set filters.The current filters will be replaced.
- Parameters:
filters- the filters to set- Returns:
- this instance
-
filter
Set filters.The current filters will be replaced.
- Parameters:
filters- the filters to set- Returns:
- this instance
-
selectedFilter
Set selected filter.The filter is appended to the list of filters if not present.
- Parameters:
f- the selected filter- Returns:
- this instance
-