public class PatternFileFilter
extends javax.swing.filechooser.FileFilter
implements java.io.FileFilter, java.io.FilenameFilter
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
NULL_OBJECT_ID
Used for passing in a null object id
|
Constructor and Description |
---|
PatternFileFilter(java.lang.String patternsString)
Create a new PatternFileFilter.
|
PatternFileFilter(java.lang.String patternsString,
boolean dirsOk)
Create a new PatternFileFilter.
|
PatternFileFilter(java.lang.String patternsString,
boolean dirsOk,
boolean hiddenOk)
Create a new PatternFileFilter.
|
PatternFileFilter(java.lang.String patternsString,
java.lang.Object id,
java.lang.String description)
Create a new PatternFileFilter.
|
PatternFileFilter(java.lang.String patternsString,
java.lang.Object id,
java.lang.String description,
java.lang.String suffix)
Create a new PatternFileFilter.
|
PatternFileFilter(java.lang.String patternsString,
java.lang.String description)
Create a new PatternFileFilter.
|
PatternFileFilter(java.lang.String patternsString,
java.lang.String description,
java.lang.String suffix)
Create a new PatternFileFilter.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File file)
Does this pattern match the given file.
|
boolean |
accept(java.io.File dir,
java.lang.String name)
Implement the FilenameFilter method
|
static java.util.List |
createFilters(java.lang.String filterString)
Parse the given string and return a list of PatternFileFilter-s
The string is a ";" delimited list of pattern specifications of the
form: pattern":"description or: just the pattern.
|
java.lang.String |
getDescription()
Return the description.
|
java.lang.Object |
getId()
Return the object id.
|
java.lang.String |
getPreferredSuffix()
Get the PreferredSuffix property.
|
static void |
main(java.lang.String[] args)
Test
|
boolean |
match(java.lang.String name)
Does this pattern match the given file.
|
void |
setPreferredSuffix(java.lang.String value)
Set the PreferedSuffix property.
|
java.lang.String |
toString()
Override base class method.
|
public static final java.lang.Object NULL_OBJECT_ID
public PatternFileFilter(java.lang.String patternsString, java.lang.String description)
patternsString
- A comma separated list of regular expressions.description
- The label to use in the JFileChooserpublic PatternFileFilter(java.lang.String patternsString, java.lang.String description, java.lang.String suffix)
patternsString
- A comma separated list of regular expressions.description
- The label to use in the JFileChoosersuffix
- The preferred suffix if none is provided.public PatternFileFilter(java.lang.String patternsString)
patternsString
- A comma separated list of regular expressions.public PatternFileFilter(java.lang.String patternsString, boolean dirsOk)
patternsString
- A comma separated list of regular expressions.dirsOk
- Are directories ok to display.public PatternFileFilter(java.lang.String patternsString, boolean dirsOk, boolean hiddenOk)
patternsString
- A comma separated list of regular expressions.dirsOk
- Are directories ok to display.hiddenOk
- true if hidden files are okay.public PatternFileFilter(java.lang.String patternsString, java.lang.Object id, java.lang.String description)
patternsString
- A comma separated list of regular expressions.id
- An arbitary Object for client code to use.description
- The label to use in the JFileChooserpublic PatternFileFilter(java.lang.String patternsString, java.lang.Object id, java.lang.String description, java.lang.String suffix)
patternsString
- A comma separated list of regular expressions.id
- An arbitary Object for client code to use.description
- The label to use in the JFileChoosersuffix
- The preferred suffix if none is provided.public static java.util.List createFilters(java.lang.String filterString)
filterString
- The string of semi-colon delimited filters.public java.lang.Object getId()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean accept(java.io.File file)
accept
in interface java.io.FileFilter
accept
in class javax.swing.filechooser.FileFilter
file
- The given file.public boolean accept(java.io.File dir, java.lang.String name)
accept
in interface java.io.FilenameFilter
dir
- directory to checkname
- name of filepublic boolean match(java.lang.String name)
name
- The given file.public java.lang.String getDescription()
getDescription
in class javax.swing.filechooser.FileFilter
public void setPreferredSuffix(java.lang.String value)
value
- The new value for PreferedSuffixpublic java.lang.String getPreferredSuffix()
public static void main(java.lang.String[] args)
args
- Command line args.