Package ucar.unidata.util
Class PatternFileFilter
java.lang.Object
javax.swing.filechooser.FileFilter
ucar.unidata.util.PatternFileFilter
- All Implemented Interfaces:
- FileFilter,- FilenameFilter
This holds a set of regular expression patterns that are used for file filters in a JFileChooser.
  You can also pass in an Object id (which can be used as the client code sees fit) and a directoriesOk
  flag.
- Author:
- Metapps development team
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionPatternFileFilter(String patternsString) Create a new PatternFileFilter.PatternFileFilter(String patternsString, boolean dirsOk) Create a new PatternFileFilter.PatternFileFilter(String patternsString, boolean dirsOk, boolean hiddenOk) Create a new PatternFileFilter.PatternFileFilter(String patternsString, Object id, String description) Create a new PatternFileFilter.PatternFileFilter(String patternsString, Object id, String description, String suffix) Create a new PatternFileFilter.PatternFileFilter(String patternsString, String description) Create a new PatternFileFilter.PatternFileFilter(String patternsString, String description, String suffix) Create a new PatternFileFilter.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanDoes this pattern match the given file.booleanImplement the FilenameFilter methodstatic ListcreateFilters(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.Return the description.getId()Return the object id.Get the PreferredSuffix property.static voidTestbooleanDoes this pattern match the given file.voidsetPreferredSuffix(String value) Set the PreferedSuffix property.toString()Override base class method.
- 
Field Details- 
NULL_OBJECT_IDUsed for passing in a null object id
 
- 
- 
Constructor Details- 
PatternFileFilterCreate a new PatternFileFilter.- Parameters:
- patternsString- A comma separated list of regular expressions.
- description- The label to use in the JFileChooser
 
- 
PatternFileFilterCreate a new PatternFileFilter.- Parameters:
- patternsString- A comma separated list of regular expressions.
- description- The label to use in the JFileChooser
- suffix- The preferred suffix if none is provided.
 
- 
PatternFileFilterCreate a new PatternFileFilter.- Parameters:
- patternsString- A comma separated list of regular expressions.
 
- 
PatternFileFilterCreate a new PatternFileFilter.- Parameters:
- patternsString- A comma separated list of regular expressions.
- dirsOk- Are directories ok to display.
 
- 
PatternFileFilterCreate a new PatternFileFilter.- Parameters:
- patternsString- A comma separated list of regular expressions.
- dirsOk- Are directories ok to display.
- hiddenOk- true if hidden files are okay.
 
- 
PatternFileFilterCreate a new PatternFileFilter.- Parameters:
- patternsString- A comma separated list of regular expressions.
- id- An arbitary Object for client code to use.
- description- The label to use in the JFileChooser
 
- 
PatternFileFilterCreate a new PatternFileFilter.- Parameters:
- patternsString- A comma separated list of regular expressions.
- id- An arbitary Object for client code to use.
- description- The label to use in the JFileChooser
- suffix- The preferred suffix if none is provided.
 
 
- 
- 
Method Details- 
createFiltersParse 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. E.g.: ".*\.nc:Netcdf files;.*\.html;.*\.txt:Text files"- Parameters:
- filterString- The string of semi-colon delimited filters.
- Returns:
- List of PatternFileFilter objects.
 
- 
getIdReturn the object id.- Returns:
- the object id.
 
- 
toStringOverride base class method.
- 
acceptDoes this pattern match the given file.- Specified by:
- acceptin interface- FileFilter
- Specified by:
- acceptin class- FileFilter
- Parameters:
- file- The given file.
- Returns:
- Does this pattern match the given file.
 
- 
acceptImplement the FilenameFilter method- Specified by:
- acceptin interface- FilenameFilter
- Parameters:
- dir- directory to check
- name- name of file
- Returns:
- true if we should accept this.
 
- 
matchDoes this pattern match the given file.- Parameters:
- name- The given file.
- Returns:
- Does this pattern match the given file.
 
- 
getDescriptionReturn the description.- Specified by:
- getDescriptionin class- FileFilter
- Returns:
- the description.
 
- 
setPreferredSuffixSet the PreferedSuffix property.- Parameters:
- value- The new value for PreferedSuffix
 
- 
getPreferredSuffixGet the PreferredSuffix property.- Returns:
- The PreferredSuffix
 
- 
mainTest- Parameters:
- args- Command line args.
 
 
-