com.clearfield.security
Class BaseFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by com.clearfield.security.BaseFileFilter

public class BaseFileFilter
extends javax.swing.filechooser.FileFilter

The filter class which allows the simple setting of file filters.

Copyright © 2006 Clearfield Ltd. This software is distributed under the BSD license. See the accompanying license.txt for details.

Version:
1.0.0
Author:
Dr. David J. Knowles

Field Summary
protected  java.lang.String description
           
protected  java.lang.String[] extensions
           
 
Constructor Summary
BaseFileFilter(java.lang.String[] extensions, java.lang.String description)
          Constructor for the filter.
 
Method Summary
 boolean accept(java.io.File file)
          Core function of the filter.
 java.lang.String getDescription()
          Returns the human readable version of this filter.
protected  java.lang.String getExtension(java.io.File file)
          Return the extension of the filename .
protected  boolean isCorrectExtension(java.lang.String extension)
          Determines if the file extension matches those known by the filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extensions

protected java.lang.String[] extensions

description

protected java.lang.String description
Constructor Detail

BaseFileFilter

public BaseFileFilter(java.lang.String[] extensions,
                      java.lang.String description)
Constructor for the filter. This takes two parameters the file extensions and the basic description of the files.

Parameters:
extensions - String array of possible extensions.
description - String base human description of the files.
Method Detail

accept

public boolean accept(java.io.File file)
Core function of the filter. This determines if the file matches the criteria for this filter.

Specified by:
accept in class javax.swing.filechooser.FileFilter
Parameters:
file - File to match.
Returns:
boolean true if the file is acceptable.

getDescription

public java.lang.String getDescription()
Returns the human readable version of this filter.

Specified by:
getDescription in class javax.swing.filechooser.FileFilter
Returns:
String description.

isCorrectExtension

protected boolean isCorrectExtension(java.lang.String extension)
Determines if the file extension matches those known by the filter.

Parameters:
extension - String extension to match
Returns:
boolean true if the extension matches.

getExtension

protected java.lang.String getExtension(java.io.File file)
Return the extension of the filename .

Returns:
String extension of the file.