Package gov.nih.mipav.view
Class FileSelectorImpl
java.lang.Object
gov.nih.mipav.view.FileSelectorImpl
- All Implemented Interfaces:
FileSelector
The implementation of the FileSelector interface for the local file
system, for the remote file system you should have different implementation,
basically this class is a wrapper of the JFileChooser.
- Version:
- 1.0, 06/21/2006
- Author:
- Hailong Wang, Ph.D
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the file filter used byFileSelector.private FileFiltergetFileFilter(int index) A private helper function to get the current used FileFilter from JFileChooser.String[]Returns the selected file names.static voidstatic FileSelectorImplvoidsetFileFilter(FileFilter fileFilter) Sets the file filter to theFileSelector.private voidshowDialog(Component parent, String title, String approveButtonName) Sets up the parameters and show the dialog to let user make selection.voidshowOpenDialog(Component parent) Shows the open dialog to retrieve the user's input, the approve button will be "Open", and title will be "Open Image", only files are displayed, multi selection will be allowed.voidshowSaveAsDialog(Component parent) Shows the save as dialog to retrieve the user's input, the approve button will be "Save", and title will be "Save Image As", only file are displayed, multi selection is not allowed.voidshowSaveDialog(Component parent) Shows the open dialog to retrieve the user's input, the approve button will be "Save", and title will be "Save Image", only directory are displayed, multi selection is not allowed.
-
Field Details
-
fileChooser
-
-
Constructor Details
-
FileSelectorImpl
private FileSelectorImpl()
-
-
Method Details
-
newInstance
-
getFileFilter
Description copied from interface:FileSelectorReturns the file filter used byFileSelector.- Specified by:
getFileFilterin interfaceFileSelector- Returns:
- the file filter used by
FileSelector. - See Also:
-
setFileFilter
Description copied from interface:FileSelectorSets the file filter to theFileSelector.- Specified by:
setFileFilterin interfaceFileSelector- Parameters:
fileFilter- the new file filter.- See Also:
-
getSelectedFileNames
Description copied from interface:FileSelectorReturns the selected file names. Notes: I want this interface to cover the SRB file selection. So I used the string array as the return type.- Specified by:
getSelectedFileNamesin interfaceFileSelector- Returns:
- the selected file names.
- See Also:
-
showOpenDialog
Description copied from interface:FileSelectorShows the open dialog to retrieve the user's input, the approve button will be "Open", and title will be "Open Image", only files are displayed, multi selection will be allowed.- Specified by:
showOpenDialogin interfaceFileSelector- Parameters:
parent- the parent component- See Also:
-
showSaveDialog
Description copied from interface:FileSelectorShows the open dialog to retrieve the user's input, the approve button will be "Save", and title will be "Save Image", only directory are displayed, multi selection is not allowed.- Specified by:
showSaveDialogin interfaceFileSelector- Parameters:
parent- the parent component- See Also:
-
showSaveAsDialog
Description copied from interface:FileSelectorShows the save as dialog to retrieve the user's input, the approve button will be "Save", and title will be "Save Image As", only file are displayed, multi selection is not allowed.- Specified by:
showSaveAsDialogin interfaceFileSelector- Parameters:
parent- the parent component- See Also:
-
showDialog
Sets up the parameters and show the dialog to let user make selection. If user approves the selection, then stores the image directory.- Parameters:
parent- the parent component of the dialog.title- the title of the dialog.approveButtonName- the approve button name of the dialog.
-
getFileFilter
A private helper function to get the current used FileFilter from JFileChooser.- Parameters:
index- the index of the choosable file filters.- Returns:
- the current used file filter.
-
main
-