gov.sns.tools.apputils.files
Class FileFilterFactory

java.lang.Object
  |
  +--gov.sns.tools.apputils.files.FileFilterFactory

public class FileFilterFactory
extends java.lang.Object

FileFilterFactory generates file filters based on supplied file types.


Constructor Summary
protected FileFilterFactory()
          Creates a new instance of FileFilterFactory
 
Method Summary
static javax.swing.JFileChooser applyFileFilters(javax.swing.JFileChooser fileChooser, java.lang.String[] fileTypes)
          Applies the file filters to the file chooser and returns this file chooser.
static javax.swing.filechooser.FileFilter getFileFilter(java.lang.String fileType)
          Create a file filter that accepts files of the specified type.
static javax.swing.filechooser.FileFilter getSupportedFileFilter(java.lang.String[] fileTypes)
          Create a file filter that accepts files of the specified types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileFilterFactory

protected FileFilterFactory()
Creates a new instance of FileFilterFactory

Method Detail

applyFileFilters

public static javax.swing.JFileChooser applyFileFilters(javax.swing.JFileChooser fileChooser,
                                                        java.lang.String[] fileTypes)
Applies the file filters to the file chooser and returns this file chooser. Existing file filters are removed from the file chooser and then new file filters are added to the file chooser consistent with the specified file types.

Parameters:
fileChooser - the file chooser to which to add the file filters
fileTypes - An array of file types to accept
Returns:
The file chooser that accepts the specified file types (same file chooser as the argument)

getFileFilter

public static javax.swing.filechooser.FileFilter getFileFilter(java.lang.String fileType)
Create a file filter that accepts files of the specified type. This is a supporting method for creating file choosers. A type is identified by its filename suffix.

Parameters:
fileType - File type to accept
Returns:
The file filter that accepts the specified file type

getSupportedFileFilter

public static javax.swing.filechooser.FileFilter getSupportedFileFilter(java.lang.String[] fileTypes)
Create a file filter that accepts files of the specified types. This is a supporting method for creating file choosers. A type is identified by its filename suffix.

Parameters:
fileTypes - Array of file types to accept
Returns:
The file filter that accepts the specified file types