- All Superinterfaces:
FilePicker
- All Known Implementing Classes:
NativeFileSavePicker,WebFileSavePicker
Interface for a file save picker component that allows users to select a file destination for saving.
Extends the
FilePicker interface to provide additional functionality for saving files.
This interface provides methods for handling file save operations in a JavaFX application, with implementations that can work in both web browser and native environments.
Use the static create(Node) method to obtain an instance of FileSavePicker,
which will return a suitable implementation depending on the runtime environment.
Example usage:
FileSavePicker fileSavePicker = FileSavePicker.create(node);
fileSavePicker.setOnFileSelected(file -> {
return return file -> CompletableFuture.runAsync(() -> {
// Handle file saving logic here
});
});
- Author:
- Besmir Beqiri
- See Also:
-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.ObjectProperty<Function<File, CompletableFuture<Void>>> Returns the property representing the handler function that is called when the user selects a file.Properties inherited from interface one.jpro.platform.file.picker.FilePicker
initialDirectory, initialFileName, selectedExtensionFilter, title -
Method Summary
Modifier and TypeMethodDescriptionstatic FileSavePickercreate(javafx.scene.Node node) Creates a new instance ofFileSavePickerassociated with the specifiedNode.Gets the handler function that is called when the user selects a file to save.javafx.beans.property.ObjectProperty<Function<File, CompletableFuture<Void>>> Returns the property representing the handler function that is called when the user selects a file.voidsetOnFileSelected(Function<File, CompletableFuture<Void>> value) Sets the handler function to be called when the user selects a file to save.Methods inherited from interface one.jpro.platform.file.picker.FilePicker
getExtensionFilters, getInitialDirectory, getInitialFileName, getNode, getSelectedExtensionFilter, getTitle, initialDirectoryProperty, initialFileNameProperty, selectedExtensionFilterProperty, setInitialDirectory, setInitialFileName, setSelectedExtensionFilter, setTitle, titleProperty
-
Property Details
-
onFileSelected
javafx.beans.property.ObjectProperty<Function<File,CompletableFuture<Void>>> onFileSelectedPropertyReturns the property representing the handler function that is called when the user selects a file. This property allows for observing changes to the handler and for binding. The handler function accepts aFileand returns aCompletableFuture<Void> indicating when the file save operation has completed.- See Also:
-
-
Method Details
-
create
Creates a new instance ofFileSavePickerassociated with the specifiedNode. Depending on whether the application is running in a browser or not, it returns an appropriate implementation.- Parameters:
node- the JavaFX node associated with the file save picker- Returns:
- a new instance of
FileSavePicker
-
getOnFileSelected
Function<File,CompletableFuture<Void>> getOnFileSelected()Gets the handler function that is called when the user selects a file to save. The handler accepts aFileand returns aCompletableFuture<Void> indicating when the file save operation has completed.- Returns:
- the handler function for file selection, or
nullif none is set
-
setOnFileSelected
Sets the handler function to be called when the user selects a file to save. The handler function should accept aFileobject and return aCompletableFuture<Void> that completes when the save operation is finished.- Parameters:
value- the handler function to set, ornullto remove any existing handler
-
onFileSelectedProperty
javafx.beans.property.ObjectProperty<Function<File,CompletableFuture<Void>>> onFileSelectedProperty()Returns the property representing the handler function that is called when the user selects a file. This property allows for observing changes to the handler and for binding. The handler function accepts aFileand returns aCompletableFuture<Void> indicating when the file save operation has completed.- Returns:
- the property containing the handler function for file selection
- See Also:
-