org.fife.ui.rtextfilechooser.filters
Class ExtensionFileFilter

java.lang.Object
  extended byjavax.swing.filechooser.FileFilter
      extended byorg.fife.ui.rtextfilechooser.filters.ExtensionFileFilter

public class ExtensionFileFilter
extends javax.swing.filechooser.FileFilter

A file filter for JFileChoosers that filters using extensions given by the user.

Version:
1.0
Author:
Robert Futrell

Field Summary
static int CASE_CHECK
           
static int NO_CASE_CHECK
           
static int SYSTEM_CASE_CHECK
           
 
Constructor Summary
ExtensionFileFilter(java.lang.String description, java.lang.String extension)
          Constructor.
ExtensionFileFilter(java.lang.String description, java.lang.String[] extensions)
          Constructor.
ExtensionFileFilter(java.lang.String description, java.lang.String[] extensions, int caseCheck)
          Constructor.
ExtensionFileFilter(java.lang.String description, java.lang.String[] extensions, int caseCheck, boolean showExtensions)
          Constructor.
ExtensionFileFilter(java.lang.String description, java.lang.String extension, int caseCheck)
          Constructor.
ExtensionFileFilter(java.lang.String description, java.lang.String extension, int caseCheck, boolean showExtensions)
          Constructor.
 
Method Summary
 boolean accept(java.io.File f)
          Accepts all directories and all files matching the specified extensions.
 java.lang.String getDescription()
          Returns the description of this filter, displayed in the file chooser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM_CASE_CHECK

public static final int SYSTEM_CASE_CHECK
See Also:
Constant Field Values

CASE_CHECK

public static final int CASE_CHECK
See Also:
Constant Field Values

NO_CASE_CHECK

public static final int NO_CASE_CHECK
See Also:
Constant Field Values
Constructor Detail

ExtensionFileFilter

public ExtensionFileFilter(java.lang.String description,
                           java.lang.String extension)
Constructor. The created file filter will use the case-sensitivity of the operating system.

Parameters:
description - The description of this file filter, as will be displayed in the file chooser.
extension - The single extension files can have to match this filter. This string should be everything after the final ".".

ExtensionFileFilter

public ExtensionFileFilter(java.lang.String description,
                           java.lang.String[] extensions)
Constructor. The created file filter will use the case-sensitivity of the operating system.

Parameters:
description - The description of this file filter, as will be displayed in the file chooser.
extensions - The extensions files can have to match this filter. These strings should be everything after the final ".".

ExtensionFileFilter

public ExtensionFileFilter(java.lang.String description,
                           java.lang.String extension,
                           int caseCheck)
Constructor.

Parameters:
description - The description of this file filter, as displayed in the file chooser.
extension - The single extension files can have to match this filter. This string should be everything after the final ".".
caseCheck - Whether the case of the file's extension should be taken into consideration when deciding whether files pass this filter.

ExtensionFileFilter

public ExtensionFileFilter(java.lang.String description,
                           java.lang.String[] extensions,
                           int caseCheck)
Constructor.

Parameters:
description - The description of this file filter, as displayed in the file chooser.
extensions - The extensions files can have to match this filter. These strings should be everything after the final ".".
caseCheck - Whether the case of the file's extension should be taken into consideration when deciding whether files pass this filter.

ExtensionFileFilter

public ExtensionFileFilter(java.lang.String description,
                           java.lang.String extension,
                           int caseCheck,
                           boolean showExtensions)
Constructor.

Parameters:
description - The description of this file filter, as displayed in the file chooser.
extension - The single extension files can have to match this filter. This string should be everything after the final ".".
caseCheck - Whether the case of the file's extension should be taken into consideration when deciding whether files pass this filter.
showExtensions - Whether the accepted extensions should be displayed in the description.

ExtensionFileFilter

public ExtensionFileFilter(java.lang.String description,
                           java.lang.String[] extensions,
                           int caseCheck,
                           boolean showExtensions)
Constructor.

Parameters:
description - The description of this file filter, as displayed in the file chooser.
extensions - The extensions files can have to match this filter. These strings should be everything after the final ".".
caseCheck - Whether the case of the file's extension should be taken into consideration when deciding whether files pass this filter.
showExtensions - Whether the accepted extensions should be displayed in the description.
Method Detail

accept

public boolean accept(java.io.File f)
Accepts all directories and all files matching the specified extensions.

Parameters:
f - The file to check.
Returns:
Whether the file was accepted.

getDescription

public java.lang.String getDescription()
Returns the description of this filter, displayed in the file chooser.

Returns:
The description.