- All Implemented Interfaces:
MultipleFileSelector,FileOpenPicker,FilePicker
FileOpenPicker implementation for JavaFX desktop/mobile
applications. This class specializes for selecting and opening files from
the native file system. Depending on the configuration (e.g. extension filters and
selection mode), it will display either a FileChooser or a DirectoryChooser.- Author:
- Besmir Beqiri, Indrit Beqiri, Florian Kirmaier
- See Also:
-
Property Summary
PropertiesTypePropertyDescriptionfinal javafx.beans.property.ObjectProperty<File> Defines the initial directory for the displayed file dialog.final javafx.beans.property.StringPropertyThe initial file name for the displayed dialog.javafx.beans.property.ObjectProperty<Consumer<List<? extends FileSource>>> Defines the handler to be called when the user selects files.final javafx.beans.property.ObjectProperty<ExtensionFilter> This property is used to pre-select the extension filter for the next displayed dialog and to read the user-selected extension filter from the dismissed dialog.final javafx.beans.property.ObjectProperty<javafx.scene.control.SelectionMode> Defines the selection mode.final javafx.beans.property.StringPropertyThe title of the displayed file dialog.Properties inherited from interface one.jpro.platform.file.picker.FilePicker
initialDirectory, initialFileName, selectedExtensionFilter, title -
Constructor Summary
ConstructorsConstructorDescriptionNativeFileOpenPicker(javafx.scene.Node node) Initializes a new instance associated with the specified node. -
Method Summary
Modifier and TypeMethodDescriptionfinal javafx.collections.ObservableList<ExtensionFilter> Gets the extension filters used in the displayed file dialog.final FileThe initial directory for the displayed file dialog.final StringThe initial file name for the displayed dialog.final javafx.scene.NodegetNode()Returns the associated node for this file picker.final Consumer<List<? extends FileSource>> Gets the handler to be called when the user selects files.final ExtensionFilterGets the extension filter which is currently selected in the displayed file dialog.final javafx.scene.control.SelectionModeReturns the selection mode.final StringgetTitle()Gets the title of the displayed file dialog.final javafx.beans.property.ObjectProperty<File> Defines the initial directory for the displayed file dialog.final javafx.beans.property.StringPropertyThe initial file name for the displayed dialog.javafx.beans.property.ObjectProperty<Consumer<List<? extends FileSource>>> Defines the handler to be called when the user selects files.final javafx.beans.property.ObjectProperty<ExtensionFilter> This property is used to pre-select the extension filter for the next displayed dialog and to read the user-selected extension filter from the dismissed dialog.final javafx.beans.property.ObjectProperty<javafx.scene.control.SelectionMode> Defines the selection mode.final voidsetInitialDirectory(File value) Sets the initial directory for the displayed file dialog.final voidsetInitialFileName(String value) Sets the initial file name for the displayed dialog.final voidsetOnFilesSelected(Consumer<List<? extends FileSource>> value) Sets the handler to be called when the user selects files.final voidSets the extension filter which is currently selected in the displayed file dialog.final voidsetSelectionMode(javafx.scene.control.SelectionMode value) Sets the selection mode.final voidSets the title of the displayed file dialog.final javafx.beans.property.StringPropertyThe title of the displayed file dialog.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
-
selectionMode
public final javafx.beans.property.ObjectProperty<javafx.scene.control.SelectionMode> selectionModeProperty- Returns:
- the
selectionModeproperty - See Also:
-
onFilesSelected
public javafx.beans.property.ObjectProperty<Consumer<List<? extends FileSource>>> onFilesSelectedProperty- Specified by:
onFilesSelectedPropertyin interfaceMultipleFileSelector- Returns:
- the
onFilesSelectedproperty - See Also:
-
initialFileName
public final javafx.beans.property.StringProperty initialFileNameProperty- Specified by:
initialFileNamePropertyin interfaceFilePicker- Returns:
- the
initialFileNameproperty - See Also:
-
initialDirectory
- Specified by:
initialDirectoryPropertyin interfaceFilePicker- Returns:
- the
initialDirectoryproperty - See Also:
-
title
public final javafx.beans.property.StringProperty titleProperty- Specified by:
titlePropertyin interfaceFilePicker- Returns:
- the
titleproperty - See Also:
-
selectedExtensionFilter
- Specified by:
selectedExtensionFilterPropertyin interfaceFilePicker- Returns:
- the
selectedExtensionFilterproperty - See Also:
-
-
Constructor Details
-
NativeFileOpenPicker
public NativeFileOpenPicker(javafx.scene.Node node) Initializes a new instance associated with the specified node.- Parameters:
node- The node associated with this file picker.
-
-
Method Details
-
selectionModeProperty
public final javafx.beans.property.ObjectProperty<javafx.scene.control.SelectionMode> selectionModeProperty()Description copied from interface:MultipleFileSelectorDefines the selection mode. The selection mode determines how the file dialog allows the user to select files.- Returns:
- the
selectionModeproperty - See Also:
-
getSelectionMode
public final javafx.scene.control.SelectionMode getSelectionMode()Description copied from interface:MultipleFileSelectorReturns the selection mode.The default value is
SelectionMode.SINGLE.- Specified by:
getSelectionModein interfaceMultipleFileSelector- Returns:
- the selection mode of the file dialog
-
setSelectionMode
public final void setSelectionMode(javafx.scene.control.SelectionMode value) Description copied from interface:MultipleFileSelectorSets the selection mode.- Specified by:
setSelectionModein interfaceMultipleFileSelector- Parameters:
value- The selection mode to be set. This should be one of the values defined in the SelectionMode enumeration. Possible values areSelectionMode.SINGLEorSelectionMode.MULTIPLE.
-
getOnFilesSelected
Description copied from interface:MultipleFileSelectorGets the handler to be called when the user selects files.- Specified by:
getOnFilesSelectedin interfaceMultipleFileSelector- Returns:
- the event handler or
null.
-
setOnFilesSelected
Description copied from interface:MultipleFileSelectorSets the handler to be called when the user selects files.- Specified by:
setOnFilesSelectedin interfaceMultipleFileSelector- Parameters:
value- the event handler ornull.
-
onFilesSelectedProperty
public javafx.beans.property.ObjectProperty<Consumer<List<? extends FileSource>>> onFilesSelectedProperty()Description copied from interface:MultipleFileSelectorDefines the handler to be called when the user selects files. The handler returns the selected files ornullif no file has been selected.- Specified by:
onFilesSelectedPropertyin interfaceMultipleFileSelector- Returns:
- the
onFilesSelectedproperty - See Also:
-
getNode
public final javafx.scene.Node getNode()Description copied from interface:FilePickerReturns the associated node for this file picker.- Specified by:
getNodein interfaceFilePicker- Returns:
- the associated node for this file picker.
-
initialFileNameProperty
public final javafx.beans.property.StringProperty initialFileNameProperty()Description copied from interface:FilePickerThe initial file name for the displayed dialog.This property is used mostly in the displayed file save dialogs as the initial file name for the file being saved. If set for a file open dialog it will have any impact on the displayed dialog only if the corresponding platform provides support for such property in its file open dialogs.
- Specified by:
initialFileNamePropertyin interfaceFilePicker- Returns:
- the
initialFileNameproperty - See Also:
-
getInitialFileName
Description copied from interface:FilePickerThe initial file name for the displayed dialog.- Specified by:
getInitialFileNamein interfaceFilePicker- Returns:
- the file name as a string
-
setInitialFileName
Description copied from interface:FilePickerSets the initial file name for the displayed dialog.- Specified by:
setInitialFileNamein interfaceFilePicker- Parameters:
value- the file name
-
initialDirectoryProperty
Description copied from interface:FilePickerDefines the initial directory for the displayed file dialog.- Specified by:
initialDirectoryPropertyin interfaceFilePicker- Returns:
- the
initialDirectoryproperty - See Also:
-
getInitialDirectory
Description copied from interface:FilePickerThe initial directory for the displayed file dialog.- Specified by:
getInitialDirectoryin interfaceFilePicker- Returns:
- the initial directory as a
Fileobject
-
setInitialDirectory
Description copied from interface:FilePickerSets the initial directory for the displayed file dialog.- Specified by:
setInitialDirectoryin interfaceFilePicker- Parameters:
value- the initial directory as aFileobject
-
getTitle
Description copied from interface:FilePickerGets the title of the displayed file dialog.- Specified by:
getTitlein interfaceFilePicker- Returns:
- the title string
-
setTitle
Description copied from interface:FilePickerSets the title of the displayed file dialog.- Specified by:
setTitlein interfaceFilePicker- Parameters:
value- the title string
-
titleProperty
public final javafx.beans.property.StringProperty titleProperty()Description copied from interface:FilePickerThe title of the displayed file dialog.- Specified by:
titlePropertyin interfaceFilePicker- Returns:
- the
titleproperty - See Also:
-
getExtensionFilters
Description copied from interface:FilePickerGets the extension filters used in the displayed file dialog. Only one extension filter from the list is active at any time in the displayed dialog and only files which correspond to this extension filter are shown. The first extension filter from the list is activated when the dialog is invoked. Then the user can switch the active extension filter to any other extension filter from the list and in this way control the set of displayed files.- Specified by:
getExtensionFiltersin interfaceFilePicker- Returns:
- An observable list of the extension filters used in the dialog
-
getSelectedExtensionFilter
Description copied from interface:FilePickerGets the extension filter which is currently selected in the displayed file dialog.- Specified by:
getSelectedExtensionFilterin interfaceFilePicker- Returns:
- the selected extension filter or
nullif no extension
-
setSelectedExtensionFilter
Description copied from interface:FilePickerSets the extension filter which is currently selected in the displayed file dialog.- Specified by:
setSelectedExtensionFilterin interfaceFilePicker- Parameters:
filter- the selected extension filter
-
selectedExtensionFilterProperty
public final javafx.beans.property.ObjectProperty<ExtensionFilter> selectedExtensionFilterProperty()Description copied from interface:FilePickerThis property is used to pre-select the extension filter for the next displayed dialog and to read the user-selected extension filter from the dismissed dialog.When the file dialog is shown, the selectedExtensionFilter will be checked. If the value of selectedExtensionFilter is null or is not contained in the list of extension filters, then the first extension filter in the list of extension filters will be selected instead. Otherwise, the specified selectedExtensionFilter will be activated.
After the dialog is dismissed the value of this property is updated to match the user-selected extension filter from the dialog.
- Specified by:
selectedExtensionFilterPropertyin interfaceFilePicker- Returns:
- the
selectedExtensionFilterproperty - See Also:
-