Package gov.nih.mipav.view
Class FileSelectorImpl
- java.lang.Object
-
- gov.nih.mipav.view.FileSelectorImpl
-
- All Implemented Interfaces:
FileSelector
public class FileSelectorImpl extends java.lang.Object implements 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 Modifier and Type Field Description private javax.swing.JFileChooserfileChooser
-
Constructor Summary
Constructors Modifier Constructor Description privateFileSelectorImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.filechooser.FileFiltergetFileFilter()Returns the file filter used byFileSelector.private javax.swing.filechooser.FileFiltergetFileFilter(int index)A private helper function to get the current used FileFilter from JFileChooser.java.lang.String[]getSelectedFileNames()Returns the selected file names.static voidmain(java.lang.String[] args)static FileSelectorImplnewInstance()voidsetFileFilter(javax.swing.filechooser.FileFilter fileFilter)Sets the file filter to theFileSelector.private voidshowDialog(java.awt.Component parent, java.lang.String title, java.lang.String approveButtonName)Sets up the parameters and show the dialog to let user make selection.voidshowOpenDialog(java.awt.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(java.awt.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(java.awt.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.
-
-
-
Method Detail
-
newInstance
public static FileSelectorImpl newInstance()
-
getFileFilter
public javax.swing.filechooser.FileFilter getFileFilter()
Description copied from interface:FileSelectorReturns the file filter used byFileSelector.- Specified by:
getFileFilterin interfaceFileSelector- Returns:
- the file filter used by
FileSelector. - See Also:
FileSelector.getFileFilter()
-
setFileFilter
public void setFileFilter(javax.swing.filechooser.FileFilter fileFilter)
Description copied from interface:FileSelectorSets the file filter to theFileSelector.- Specified by:
setFileFilterin interfaceFileSelector- Parameters:
fileFilter- the new file filter.- See Also:
FileSelector.setFileFilter(FileFilter)
-
getSelectedFileNames
public java.lang.String[] 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:
FileSelector.getSelectedFileNames()
-
showOpenDialog
public void showOpenDialog(java.awt.Component parent)
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:
FileSelector.showOpenDialog(Component)
-
showSaveDialog
public void showSaveDialog(java.awt.Component parent)
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:
FileSelector.showSaveDialog(Component)
-
showSaveAsDialog
public void showSaveAsDialog(java.awt.Component parent)
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:
FileSelector#showSaveAsDailog(Component)
-
showDialog
private void showDialog(java.awt.Component parent, java.lang.String title, java.lang.String approveButtonName)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
private javax.swing.filechooser.FileFilter getFileFilter(int index)
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
public static void main(java.lang.String[] args)
-
-