|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.filechooser.FileFilter
edu.neu.ccs.util.FileExtensionFilter
Class FileExtensionFilter is a file filter that
both extends javax.swing.filechooser.FileFilter
and implements java.io.FileFilter; the filter uses
0 or more file extensions to determine whether or not to accept
a file; the user can decide whether the matching should ignore
case or be case sensitive; the default is to ignore case in the
matching.
Because a filter of this class extends an abstract class and implements a related interface, such a filter may be passed to:
setFileFilter method of JFileChooser.listFiles method of File.A filter of this class returns true for directories.
This class generalizes and supercedes the inner class
ExtensionFileFilter of FileView
but that class has been left in place for backward
compatibility.
| Field Summary | |
private String[] |
arrayList
The filter as an array of extensions. |
private String |
commaList
The filter as a comma separated String. |
private String |
dialogDescription
The description for file dialog boxes. |
private boolean |
ignoreCase
Whether or not to ignore case in the match. |
private int |
N
The length of extArray. |
| Constructor Summary | |
FileExtensionFilter()
The default constructor that filters nothing. |
|
FileExtensionFilter(String commaList)
The constructor that filters files whose extensions are found in the given comma separated list. |
|
FileExtensionFilter(String[] arrayList)
The constructor that filters files whose extensions are found in the given String array. |
|
FileExtensionFilter(String[] arrayList,
boolean ignoreCase)
The constructor that filters files whose extensions are found in the given String array and sets whether to ignore case in matching. |
|
FileExtensionFilter(String commaList,
boolean ignoreCase)
The constructor that filters files whose extensions are found in the given comma separated list and sets whether to ignore case in matching. |
|
| Method Summary | |
boolean |
accept(File f)
Whether the given file is accepted by this filter. |
String |
getDescription()
Returns the text description of the filtered files for a JFileChooser dialog box. |
String |
getExtensionsAsCommaList()
Returns the extensions for this filter as a comma separated list. |
boolean |
getIgnoreCase()
Returns the current ignore case setting. |
protected String |
makeStandardDescription()
Create the standard dialog box description. |
void |
setExtensions(String commaList)
Sets the extensions to filter using the given comma separated list. |
void |
setExtensions(String[] arrayList)
Sets the extensions to filter using the given String array list. |
void |
setIgnoreCase(boolean ignoreCase)
Sets whether to ignore case when matching a file name to an extension. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private String commaList
private String[] arrayList
private int N
private boolean ignoreCase
Whether or not to ignore case in the match.
The default is true.
private String dialogDescription
| Constructor Detail |
public FileExtensionFilter()
public FileExtensionFilter(String commaList)
The constructor that filters files whose extensions are found in the given comma separated list.
By default, case is ignored in matching.
commaList - the comma separated list of extensionspublic FileExtensionFilter(String[] arrayList)
The constructor that filters files whose extensions are found in the given String array.
By default, case is ignored in matching.
arrayList - the array list of extensions
public FileExtensionFilter(String commaList,
boolean ignoreCase)
The constructor that filters files whose extensions are found in the given comma separated list and sets whether to ignore case in matching.
commaList - the comma separated list of extensionsignoreCase - whether to ignore case in matching
public FileExtensionFilter(String[] arrayList,
boolean ignoreCase)
The constructor that filters files whose extensions are found in the given String array and sets whether to ignore case in matching.
arrayList - the array list of extensionsignoreCase - whether to ignore case in matching| Method Detail |
public final void setExtensions(String commaList)
Sets the extensions to filter using the given comma separated list.
commaList - the comma separated list of extensionspublic final void setExtensions(String[] arrayList)
Sets the extensions to filter using the given String array list.
arrayList - the array list of extensionspublic final String getExtensionsAsCommaList()
public final void setIgnoreCase(boolean ignoreCase)
Sets whether to ignore case when matching a file name to an extension.
ignoreCase - whether to ignore case in matchingpublic final boolean getIgnoreCase()
public final boolean accept(File f)
Whether the given file is accepted by this filter.
accept in interface FileFilterf - the file to testpublic String getDescription()
JFileChooser dialog box.
protected String makeStandardDescription()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||