de.jstacs.io
Class SubstringFilenameFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by de.jstacs.io.SubstringFilenameFilter
All Implemented Interfaces:
FileFilter, FilenameFilter

public class SubstringFilenameFilter
extends FileFilter
implements FileFilter, FilenameFilter

A simple filter on files.

Author:
Jens Keilwagen

Nested Class Summary
static class SubstringFilenameFilter.PartOfName
          This enum defines the different types a string can be part of a other string.
 
Constructor Summary
SubstringFilenameFilter(SubstringFilenameFilter.PartOfName type, String desc, boolean dir, boolean ignoreCase, String... substring)
          A simple constructor.
 
Method Summary
 boolean accept(File arg0)
           
 boolean accept(File dir, String name)
           
 String getDescription()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubstringFilenameFilter

public SubstringFilenameFilter(SubstringFilenameFilter.PartOfName type,
                               String desc,
                               boolean dir,
                               boolean ignoreCase,
                               String... substring)
A simple constructor.

Parameters:
type - the type of the substring the will be searched
desc - the description of the filter, e.g. "text-files (*.txt)"
dir - a switch allow directories to be accepted;
ignoreCase - a switch whether to ignore the case of the file names or not
substring - an array of substrings, at least one substring has to be found as specific part (type) of the file name that a "real" file will be accepted
Method Detail

accept

public boolean accept(File arg0)
Specified by:
accept in interface FileFilter
Specified by:
accept in class FileFilter

accept

public boolean accept(File dir,
                      String name)
Specified by:
accept in interface FilenameFilter

getDescription

public String getDescription()
Specified by:
getDescription in class FileFilter