de.dfg.oc.logfileanalyzer.gui
Class ChoosableFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by de.dfg.oc.logfileanalyzer.gui.ChoosableFileFilter
All Implemented Interfaces:
FileFilter

public class ChoosableFileFilter
extends FileFilter
implements FileFilter

Provides a filter for the "Open file"-dialogue.

Author:
Clemens Gersbacher, Holger Prothmann

Field Summary
private  boolean acceptDirs
          true to show folders in the dialog
private  String description
          Textual description of the accepted file-type
private  String pattern
          A String defining the accepted files (e.g. "*.log" accepts all files having the extension "log")
 
Constructor Summary
ChoosableFileFilter(String description, String pattern, boolean acceptDirs)
          Creates a new file filter.
 
Method Summary
 boolean accept(File _file)
          Checks if a given file fits in the defined pattern.
 String getDescription()
          Returns a textual description of the accepted file-type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pattern

private String pattern
A String defining the accepted files (e.g. "*.log" accepts all files having the extension "log")


description

private String description
Textual description of the accepted file-type


acceptDirs

private boolean acceptDirs
true to show folders in the dialog

Constructor Detail

ChoosableFileFilter

public ChoosableFileFilter(String description,
                           String pattern,
                           boolean acceptDirs)
Creates a new file filter.

Parameters:
description - a textual description of the accepted file-type
pattern - a String defining the accepted files (e.g. "*.log" accepts all files having the extension "log")
acceptDirs - true to show folders in the dialog
Method Detail

accept

public boolean accept(File _file)
Checks if a given file fits in the defined pattern.

Specified by:
accept in interface FileFilter
Specified by:
accept in class FileFilter
Parameters:
_file - file to be checked
Returns:
true if the file matches the pattern (and will be displayed)

getDescription

public String getDescription()
Returns a textual description of the accepted file-type.

Specified by:
getDescription in class FileFilter
Returns:
a textual description of the accepted file-type