torero.util
Class ToreroFileFilter

java.lang.Object
  |
  +--javax.swing.filechooser.FileFilter
        |
        +--torero.util.ToreroFileFilter

public class ToreroFileFilter
extends FileFilter

FileFiler class used by the JFileChooser, doing the torero specific file-filtering for: .jpg, .jpeg, .trr, .torero, .y, .yacc, .g, .ox and .dot files.


Field Summary
static String[] DOT_FILTER
          .dot files, dot output files.
static String[] JPG_FILTER
          .jpeg, and .jpg files
static String[] NO_FILTER
          all kinds of files
static String[] OX_FILTER
          .ox and .y files, ox output files.
static String[] TRR_FILTER
          .trr and .torero files, serialized torero classes.
static String[] YACC_FILTER
          .y, .yacc and .g files, input grammar files.
 
Constructor Summary
ToreroFileFilter()
          Creates a new filefilter, filtering is set to NO_FILTER.
ToreroFileFilter(String[] filter_type)
          Creates a new filefilter, filtering is set to NO_FILTER.
 
Method Summary
 boolean accept(File f)
          Test if a given file f, is machted by any filter in this class.
 String getDescription()
          Get the textual description of the filefilter.
static String getExtension(File f)
          Get the extension of the given file f.
 String[] getUseAs()
          Get the file to fileextension associations.
 void setUseAs(String[] filter_type)
          Set the file to fileextension association.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_FILTER

public static final String[] NO_FILTER
all kinds of files

JPG_FILTER

public static final String[] JPG_FILTER
.jpeg, and .jpg files

TRR_FILTER

public static final String[] TRR_FILTER
.trr and .torero files, serialized torero classes.

YACC_FILTER

public static final String[] YACC_FILTER
.y, .yacc and .g files, input grammar files.

OX_FILTER

public static final String[] OX_FILTER
.ox and .y files, ox output files.

DOT_FILTER

public static final String[] DOT_FILTER
.dot files, dot output files.
Constructor Detail

ToreroFileFilter

public ToreroFileFilter()
Creates a new filefilter, filtering is set to NO_FILTER.

ToreroFileFilter

public ToreroFileFilter(String[] filter_type)
Creates a new filefilter, filtering is set to NO_FILTER.
Parameters:
filter_type, - an array describing a filetype and it's associated fileextensions.
Method Detail

setUseAs

public void setUseAs(String[] filter_type)
Set the file to fileextension association. The first element is a textual description, the rest are file extensions. e.g. {"Yacc Gammar","y","yacc","g"}
Parameters:
filter_type, - an array describing a filetype and it's associated fileextensions.

getUseAs

public String[] getUseAs()
Get the file to fileextension associations.

getExtension

public static String getExtension(File f)
Get the extension of the given file f.

accept

public boolean accept(File f)
Test if a given file f, is machted by any filter in this class.
Overrides:
accept in class FileFilter
Parameters:
f - the file to test
Returns:
true if the given file f is matched by any filter.

getDescription

public String getDescription()
Get the textual description of the filefilter.
Overrides:
getDescription in class FileFilter
Returns:
the textual description.