Klasse AbstractFileChooserOptions<T,S extends AbstractFileChooserOptions<T,S>>

java.lang.Object
net.sf.jguiraffe.gui.dlg.AbstractDialogOptions<T,S>
net.sf.jguiraffe.gui.dlg.filechooser.AbstractFileChooserOptions<T,S>
Typparameter:
T - the result type of the dialog
S - the self type
Bekannte direkte Unterklassen:
FileChooserOptions, MultiFileChooserOptions

public abstract class AbstractFileChooserOptions<T,S extends AbstractFileChooserOptions<T,S>> extends AbstractDialogOptions<T,S>

An abstract base class for the options of file chooser dialogs.

The concrete option classes for file chooser dialogs distinguish only in the result type: a single File for the normal dialog and a collection of files for the multi dialog. Therefore, this base class already defines all properties, but leaves the result type open.

Seit:
1.4
  • Konstruktordetails

    • AbstractFileChooserOptions

      protected AbstractFileChooserOptions(DialogResultCallback<T,D> resultCallback, D data)
      Creates a new instance of AbstractFileChooserOptions and sets the callback to be notified with the dialog result and an additional data object to be passed to the callback.
      Typparameter:
      D - the type of the data object
      Parameter:
      resultCallback - the result callback
      data - the data object for the callback
      Löst aus:
      IllegalArgumentException - if the result callback is null
    • AbstractFileChooserOptions

      protected AbstractFileChooserOptions(DialogResultCallback<T,?> resultCallback)
      Creates a new instance of AbstractFileChooserOptions and sets the callback to be notified with the dialog result.
      Parameter:
      resultCallback - the result callback
      Löst aus:
      IllegalArgumentException - if the result callback is null
  • Methodendetails

    • setInitialDirectory

      public S setInitialDirectory(File directory)
      Allows setting the initial directory for the file chooser dialog. When the dialog opens, the files in this directory are displayed.
      Parameter:
      directory - the initial directory
      Gibt zurück:
      this object
    • getInitialDirectory

      public File getInitialDirectory()
      Returns the initial directory for the file chooser dialog. Result can be null if no such directory has been set.
      Gibt zurück:
      the initial directory
    • setCurrentFile

      public S setCurrentFile(File file)
      Allows pre-selecting a specific file. When the dialog opens this file is already selected, but the user can select another one.
      Parameter:
      file - the file that is currently selected
      Gibt zurück:
      this object
    • getCurrentFile

      public File getCurrentFile()
      Returns the current file to be selected initially. Result can be null if no such file has been set.
      Gibt zurück:
      the currently selected file
    • setFilters

      public S setFilters(List<FileExtensionFilter> filters)
      Sets the filters for the file types to be displayed. With this option the user is given the possibility to restrict the display of files to certain predefined types. Note that a filter for all files is not added automatically; this must be done by the application.
      Parameter:
      filters - the list with file filters
      Gibt zurück:
      this object
    • setFilters

      public S setFilters(FileExtensionFilter... filters)
      Sets the filters for the file types to be displayed as var args. This method is analogous to setFilters(List), but can be called with an arbitrary number of filter objects.
      Parameter:
      filters - the file filters
      Gibt zurück:
      this object
    • setCurrentFilterIndex

      public S setCurrentFilterIndex(int index)
      Sets the index of the filter to be active when the dialog is opened. Per default, this is the first filter in the list of filters; but with this property a different filter can be selected. If the index passed to this method is out of range for the list of filters, no filter is selected explicitly. (The behavior then depends on the UI library.)
      Parameter:
      index - the index of the current filter
      Gibt zurück:
      this object
    • getCurrentFilterIndex

      public int getCurrentFilterIndex()
      Returns the index of the current filter when the dialog is opened.
      Gibt zurück:
      the index of the current filter
    • getCurrentFilter

      public FileExtensionFilter getCurrentFilter()
      Returns the current filter. This is the filter selected by the currentFilterIndex property. If the current filter index is out of range, this method returns null.
      Gibt zurück:
      the current filter or null
      Siehe auch:
    • getFilters

      public List<FileExtensionFilter> getFilters()
      Returns a (unmodifiable) list with predefined file filters. If no filters have been set, the list is empty.
      Gibt zurück:
      a list with file filters