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 dialogS
- 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
-
Konstruktorübersicht
KonstruktorenModifiziererKonstruktorBeschreibungprotected
AbstractFileChooserOptions
(DialogResultCallback<T, ?> resultCallback) Creates a new instance ofAbstractFileChooserOptions
and sets the callback to be notified with the dialog result.protected
AbstractFileChooserOptions
(DialogResultCallback<T, D> resultCallback, D data) Creates a new instance ofAbstractFileChooserOptions
and sets the callback to be notified with the dialog result and an additional data object to be passed to the callback. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungReturns the current file to be selected initially.Returns the current filter.int
Returns the index of the current filter when the dialog is opened.Returns a (unmodifiable) list with predefined file filters.Returns the initial directory for the file chooser dialog.setCurrentFile
(File file) Allows pre-selecting a specific file.setCurrentFilterIndex
(int index) Sets the index of the filter to be active when the dialog is opened.setFilters
(List<FileExtensionFilter> filters) Sets the filters for the file types to be displayed.setFilters
(FileExtensionFilter... filters) Sets the filters for the file types to be displayed as var args.setInitialDirectory
(File directory) Allows setting the initial directory for the file chooser dialog.Von Klasse geerbte Methoden net.sf.jguiraffe.gui.dlg.AbstractDialogOptions
getCancelInvoker, getResultCallback, getSelf, getTitle, getTitleResource, resolveTitle, setCanceledCallback, setCanceledCallback, setTitle, setTitleResource
-
Konstruktordetails
-
AbstractFileChooserOptions
Creates a new instance ofAbstractFileChooserOptions
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 callbackdata
- the data object for the callback- Löst aus:
IllegalArgumentException
- if the result callback is null
-
AbstractFileChooserOptions
Creates a new instance ofAbstractFileChooserOptions
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
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
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
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
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
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
Sets the filters for the file types to be displayed as var args. This method is analogous tosetFilters(List)
, but can be called with an arbitrary number of filter objects.- Parameter:
filters
- the file filters- Gibt zurück:
- this object
-
setCurrentFilterIndex
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
Returns the current filter. This is the filter selected by thecurrentFilterIndex
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
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
-