Class FileDialogResult

java.lang.Object
com.codename1.io.filechooser.FileDialogResult

public final class FileDialogResult extends Object
The outcome of a file dialog, delivered to the callback on the EDT.
  • 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
      • request: the request being answered
      • paths: the chosen paths, or null/empty when cancelled
      • selectedFilter: the filter the user ended on, or -1
      • optionValues: 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
      • request: 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
      • id: 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
      • error: the failure