com.ibm.able.rules
Class AbleRsFileFilter
java.lang.Object
|
+--javax.swing.filechooser.FileFilter
|
+--com.ibm.able.rules.AbleRsFileFilter
- public class AbleRsFileFilter
- extends javax.swing.filechooser.FileFilter
A convenience implementation of FileFilter that filters out all
files except for those file extensions that it knows about.
File extensions are of the type ".foo", which are typically found
on OS/2, Unix, and windows boxes, but not on Macinthosh. Case is
ignored.
Example - create a new filter that filters out all files
but "rs" and "frs" fuzzy rule files:
JFileChooser chooser = new JFileChooser();
AbleRsFileFilter filter = new AbleRsFileFilter(new String{"rsf", "rsfxml"})
chooser.addChoosableFileFilter(filter);
chooser.showOpenDialog(this);
Constructor Summary |
AbleRsFileFilter(java.lang.String[] theFilters,
java.lang.String theDescription)
Creates a file filter from the given string array and description. |
Method Summary |
boolean |
accept(java.io.File theFile)
Determine whether a file should be included in the dialog
selection box. |
void |
addExtension(java.lang.String theExtension)
Add another extension to the list of filters. |
java.lang.String |
getDescription()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbleRsFileFilter
public AbleRsFileFilter(java.lang.String[] theFilters,
java.lang.String theDescription)
- Creates a file filter from the given string array and description.
Example:
new AbleRsFileFilter(String {"rsf", "rsfxml"}, "Fuzzy ruleset source files");
Note that the "." before the extension is not needed and will
be ignored.
- Parameters:
theFilters
- an array of strings represent file types on which to
filter files.
- See Also:
addExtension(java.lang.String)
accept
public boolean accept(java.io.File theFile)
- Determine whether a file should be included in the dialog
selection box.
Note that files that begin with "." are ignored.
- Overrides:
accept
in class javax.swing.filechooser.FileFilter
- Parameters:
theFilters
- an array of strings that represent file types on which
to filter files.
- Returns:
- true if the file should be displayed in the
selection box, false otherwise.
getDescription
public java.lang.String getDescription()
- Overrides:
getDescription
in class javax.swing.filechooser.FileFilter
addExtension
public void addExtension(java.lang.String theExtension)
- Add another extension to the list of filters. Note that the "."
before the extension is not needed and will be ignored. Also,
case is ignored.
- Parameters:
theExtension
- an extension on which to filter.
(C) Copyright IBM Corporation 1999, 2003