Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class FileDialogResult
- Object
- FileDialogResult
The outcome of a file dialog, delivered to the callback on the EDT.
Constructors
public FileDialogResult(FileDialogRequest<?> request, String[] paths, int selectedFilter, Map<String, String> optionValues) | Creates a result; ports and the fallback dialogs build these. |
Methods
public static FileDialogResult cancelled(FileDialogRequest<?> request) | Creates the result of a dialog the user dismissed. |
public boolean isCancelled() | True when the user dismissed the dialog, or a save failed before a file existed. |
public String[] getPaths() | The chosen files. |
public String getPath() | The first chosen file. |
public int getSelectedFilterIndex() | The index of the filter the user ended on. |
public FileTypeFilter getSelectedFilter() | The filter the user ended on; for a save this is the chosen format. |
public String getOptionValue(String id) | The value of a FileDialogOption, or its default where the platform shows no options. |
public Throwable getError() | The failure of a save, or null. |
public void setError(Throwable error) | Records a save failure; used by ports. |
Inherited methods
Constructor details
FileDialogResult
public FileDialogResult(FileDialogRequest<?> request, String[] paths, int selectedFilter, Map<String, String> optionValues)Creates a result; ports and the fallback dialogs build these.
Parameters
requestFileDialogRequest<?>- the request being answered
pathsString[]- the chosen paths, or null/empty when cancelled
selectedFilterint- the filter the user ended on, or -1
optionValuesMap<String, String>- option id to value, or null for the defaults
Method details
cancelled
public static FileDialogResult cancelled(FileDialogRequest<?> request)Creates the result of a dialog the user dismissed.
Parameters
requestFileDialogRequest<?>- the request being answered
Returns
a cancelled result
isCancelled
public boolean isCancelled()True when the user dismissed the dialog, or a save failed before a file existed.
Returns
whether nothing was chosen
getPaths
public String[] getPaths()The chosen files. For a save, the one file written.
Returns
a copy of the paths; empty when cancelled
getPath
public String getPath()The first chosen file.
Returns
the path, or null when cancelled
getSelectedFilterIndex
public int getSelectedFilterIndex()The index of the filter the user ended on.
Returns
the index, or -1 without filters
getSelectedFilter
public FileTypeFilter getSelectedFilter()The filter the user ended on; for a save this is the chosen format.
Returns
the filter, or null without filters
getOptionValue
public String getOptionValue(String id)The value of a
FileDialogOption, or its default where the platform
shows no options.Parameters
idString- the option id
Returns
the value
getError
public Throwable getError()The failure of a save, or null. A failed save still reports the path it
tried, so the partial file can be cleaned up.
Returns
the error
setError
public void setError(Throwable error)Records a save failure; used by ports.
Parameters
errorThrowable- the failure