Package com.io7m.jwheatsheaf.api
Interface JWFileChooserConfigurationType
- All Known Implementing Classes:
JWFileChooserConfiguration
@Immutable
public interface JWFileChooserConfigurationType
The configuration information used to instantiate file choosers.
File choosers have a wide range of configurable properties. The only
mandatory configuration parameter is the
fileSystem(), because
this defines the initial filesystem used for file selection.-
Method Summary
Modifier and Type Method Description default JWFileChooserActionaction()default booleanallowDirectoryCreation()default voidcheckPreconditions()Check preconditions for the type.default booleanconfirmFileSelection()If set totrue, then when the user is using a mode such asJWFileChooserAction.CREATE, a confirmation dialog will be displayed if the user selects a file that already exists.java.util.Optional<java.net.URL>cssStylesheet()The CSS stylesheet that will be added to the file chooser UI.java.util.Optional<JWFileChooserFilterType>fileFilterDefault()java.util.List<JWFileChooserFilterType>fileFilters()java.util.Optional<JWFileImageSetType>fileImageSet()The image set used to select images for the file chooser UI.default java.util.function.Function<java.nio.file.Path,java.lang.Boolean>fileSelectionMode()Sets a mode that prevents returning a file to the client if that file does not meet criteria returned by this method.default JWFileSizeFormatterTypefileSizeFormatter()default java.nio.file.FileSystemfileSystem()default java.time.format.DateTimeFormatterfileTimeFormatter()java.util.Optional<java.nio.file.Path>homeDirectory()The directory to which the chooser will navigate when the user clicks the "home" button.java.util.Optional<java.nio.file.Path>initialDirectory()java.util.Optional<java.lang.String>initialFileName()java.util.List<java.nio.file.Path>recentFiles()default booleanshowParentDirectory()Determine whether or not to show a link to the parent directory inside the file listing.default JWFileChooserStringOverridesTypestringOverrides()java.util.Optional<java.lang.String>title()
-
Method Details
-
recentFiles
java.util.List<java.nio.file.Path> recentFiles()- Returns:
- The list of recent files to be shown in the file chooser
-
fileSystem
@Default default java.nio.file.FileSystem fileSystem()- Returns:
- The file system traversed by the file chooser
-
initialDirectory
java.util.Optional<java.nio.file.Path> initialDirectory()- Returns:
- The starting directory
-
homeDirectory
java.util.Optional<java.nio.file.Path> homeDirectory()The directory to which the chooser will navigate when the user clicks the "home" button. If no path is specified, the button is not shown.- Returns:
- The user's home directory
-
initialFileName
java.util.Optional<java.lang.String> initialFileName()- Returns:
- The file name initially entered into the selection field
-
title
java.util.Optional<java.lang.String> title()- Returns:
- A string that will override the generic dialog title
-
fileImageSet
java.util.Optional<JWFileImageSetType> fileImageSet()The image set used to select images for the file chooser UI. If no set is specified here, a default set of images and icons will be used.- Returns:
- An image set
-
cssStylesheet
java.util.Optional<java.net.URL> cssStylesheet()The CSS stylesheet that will be added to the file chooser UI.- Returns:
- The URL of the CSS stylesheet
-
fileFilters
java.util.List<JWFileChooserFilterType> fileFilters()- Returns:
- The list of file filters
-
fileFilterDefault
java.util.Optional<JWFileChooserFilterType> fileFilterDefault()- Returns:
- The default file filter
-
fileSelectionMode
@Default default java.util.function.Function<java.nio.file.Path,java.lang.Boolean> fileSelectionMode()Sets a mode that prevents returning a file to the client if that file does not meet criteria returned by this method. For example, this may be used to prevent selecting directories by implementing a function that returnstruewhen the file is considered a regular file.- Returns:
- The
Functionthat accepts or rejects selected files
-
allowDirectoryCreation
@Default default boolean allowDirectoryCreation()- Returns:
trueif the UI will allow the creation of directories
-
showParentDirectory
@Default default boolean showParentDirectory()Determine whether or not to show a link to the parent directory inside the file listing. This entry is always called "..".- Returns:
trueif the directory listing will contain ".."- Since:
- 3.0.0
-
fileTimeFormatter
@Default default java.time.format.DateTimeFormatter fileTimeFormatter()- Returns:
- The date/time formatter used to display file times
-
fileSizeFormatter
- Returns:
- The formatter used to display file sizes
-
action
- Returns:
- The action that the user is performing
-
checkPreconditions
@Check default void checkPreconditions()Check preconditions for the type. -
confirmFileSelection
@Default default boolean confirmFileSelection()If set totrue, then when the user is using a mode such asJWFileChooserAction.CREATE, a confirmation dialog will be displayed if the user selects a file that already exists.- Returns:
trueif confirmation dialogs should be shown- Since:
- 3.0.0
-
stringOverrides
- Returns:
- A provider of UI string overrides
- Since:
- 3.0.0
-