Class FileDialogRequest<T extends FileDialogRequest<T>>
- Direct Known Subclasses:
OpenFileRequest, SaveFileRequest
The settings shared by OpenFileRequest and SaveFileRequest.
Every setter returns the request, so a dialog is described in one chain.
Settings a platform cannot honour are ignored rather than failing, and
com.codename1.ui.Display#isFileDialogFeatureSupported(int) says up front
which ones apply. Platform specific tuning goes through #hint(String, Object).
Parameters
<T>: the concrete request type, so chained setters keep it
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringString: acontent://URI the Android picker starts in.static final StringBoolean: keep persistable read/write permission to the picked Android document across restarts.static final StringBoolean: show hidden files in the GTK chooser and the simulator.static final StringBoolean: move rather than copy the exported file on iOS.static final StringBoolean: show file extensions in the iOS document picker.static final StringBoolean: allow creating folders from a macOS panel.static final StringBoolean: let the user hide the extension in a macOS save panel.static final StringBoolean: show hidden files in a macOS panel.static final StringBoolean: show the Finder tag field in a macOS save panel.static final StringBoolean: treat packages (.app,.bundle) as folders in a macOS open panel.static final StringString: a GUID string; Windows remembers the last folder and size separately per GUID, so different dialogs of one app do not share state.static final StringString: the folder Windows shows when the user has no recent folder, as opposed toFileDialogRequest#initialDirectory, which always wins. -
Method Summary
Modifier and TypeMethodDescriptionacceptLabel(String label) Replaces the text of the Open or Save button on desktops.Embeds a Codename One component in the dialog, such as a format and quality panel for an export.addFilter(FileTypeFilter filter) Adds a file type filter.addOption(FileDialogOption option) Adds a portable control to the dialog; seeFileDialogOption.The accept button text, or null for the platform default.The accessory component, or null.booleangetBooleanHint(String key, boolean def) Reads a boolean hint.The filters in the order they were added.Reads a hint.The starting folder, or null.The explanatory message, or null.The portable controls in the order they were added.intThe initially selected filter index, clamped to the filters present.getStringHint(String key) Reads a string hint.getTitle()The window title, or null.Sets a platform specific hint; see theHINT_constants.initialDirectory(String path) Sets the folder the dialog starts in, as aFileSystemStoragepath.Sets an explanatory line shown in the dialog (NSSavePanel.messageon macOS, the fallback dialog's header elsewhere).selectedFilter(int index) Selects the filter shown initially.Sets the window title.Joins every filter's extensions and MIME types into the comma separated formcom.codename1.ui.Display#openFileChoosertakes.
-
Field Details
-
HINT_MAC_SHOWS_TAG_FIELD
Boolean: show the Finder tag field in a macOS save panel.- See Also:
-
HINT_MAC_CAN_CREATE_DIRECTORIES
Boolean: allow creating folders from a macOS panel. Defaults to true.- See Also:
-
HINT_MAC_SHOWS_HIDDEN_FILES
Boolean: show hidden files in a macOS panel.- See Also:
-
HINT_MAC_CAN_SELECT_HIDDEN_EXTENSION
Boolean: let the user hide the extension in a macOS save panel.- See Also:
-
HINT_MAC_TREATS_PACKAGES_AS_DIRECTORIES
Boolean: treat packages (.app,.bundle) as folders in a macOS open panel.- See Also:
-
HINT_IOS_SHOWS_FILE_EXTENSIONS
Boolean: show file extensions in the iOS document picker.- See Also:
-
HINT_IOS_EXPORT_AS_MOVE
Boolean: move rather than copy the exported file on iOS. Defaults to copy.- See Also:
-
HINT_ANDROID_INITIAL_URI
String: acontent://URI the Android picker starts in.- See Also:
-
HINT_ANDROID_PERSIST_PERMISSION
Boolean: keep persistable read/write permission to the picked Android document across restarts.- See Also:
-
HINT_WIN_CLIENT_GUID
String: a GUID string; Windows remembers the last folder and size separately per GUID, so different dialogs of one app do not share state.- See Also:
-
HINT_WIN_DEFAULT_FOLDER
String: the folder Windows shows when the user has no recent folder, as opposed toFileDialogRequest#initialDirectory, which always wins.- See Also:
-
HINT_DESKTOP_SHOW_HIDDEN
Boolean: show hidden files in the GTK chooser and the simulator.- See Also:
-
-
Method Details
-
title
-
message
-
acceptLabel
-
initialDirectory
-
addFilter
Adds a file type filter. The first one added is selected unless
#selectedFilter(int)says otherwise.Parameters
filter: the filter
Returns
this request
-
selectedFilter
Selects the filter shown initially.
Parameters
index: an index into the filters added so far
Returns
this request
-
hint
-
addOption
Adds a portable control to the dialog; see
FileDialogOption.Parameters
option: the control
Returns
this request
-
accessory
Embeds a Codename One component in the dialog, such as a format and quality panel for an export. Only shown where
FileDialogFeatures#ACCESSORY_COMPONENTis supported (today only the Codename One fallback save form); use#addOption(FileDialogOption)for controls that must appear on every desktop. The component is still reachable from the callback, so its state can be read after the dialog closes.Parameters
accessory: the component
Returns
this request
-
getTitle
The window title, or null.
Returns
the title
-
getMessage
The explanatory message, or null.
Returns
the message
-
getAcceptLabel
The accept button text, or null for the platform default.
Returns
the label
-
getInitialDirectory
The starting folder, or null.
Returns
the folder path
-
getFilters
The filters in the order they were added.
Returns
a copy of the filters
-
getSelectedFilter
public int getSelectedFilter()The initially selected filter index, clamped to the filters present.
Returns
the index, or -1 when there are no filters
-
getHint
-
getBooleanHint
Reads a boolean hint.
Parameters
key: the hint namedef: the value when the hint is absent or not a boolean
Returns
the value
-
getStringHint
-
getOptions
The portable controls in the order they were added.
Returns
a copy of the options
-
getAccessory
The accessory component, or null.
Returns
the accessory
-
toAcceptString
Joins every filter's extensions and MIME types into the comma separated form
com.codename1.ui.Display#openFileChoosertakes.Returns
the accept string, or null when nothing is filtered
-