org.josql.filters
Class JoSQLSwingFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by org.josql.filters.JoSQLSwingFileFilter

public class JoSQLSwingFileFilter
extends FileFilter

A FileFilter that uses a JoSQL statement to provide the filtering. The value returned by the accept(File) method is determined by executing the WHERE clause of a JoSQL statement on each File passed in. This just uses an instance of: JoSQLFileFilter to do it's job, see that class for details of usage.


Constructor Summary
JoSQLSwingFileFilter(Query q)
          Init this file filter with the query already built and parsed.
JoSQLSwingFileFilter(String q)
          Init this file filter with the query.
 
Method Summary
 boolean accept(File f)
          Apply the WHERE clause of the statement to the File passed in.
 String getDescription()
          Return the description for the filter.
 JoSQLFileFilter getJoSQLFileFilter()
          Get the file filter being used "under the hoodie" in the accept(File) method.
 void setDescription(String d)
          Set the description that should be used.
 void setJoSQLFileFilter(JoSQLFileFilter ff)
          Set the JoSQLFileFilter that should be used to handle the accept(File) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JoSQLSwingFileFilter

public JoSQLSwingFileFilter(String q)
                     throws QueryParseException
Init this file filter with the query.

Parameters:
q - The query.
Throws:
QueryParseException - If there is an issue with the parsing of the query, or if the FROM class is not File.

JoSQLSwingFileFilter

public JoSQLSwingFileFilter(Query q)
                     throws IllegalStateException,
                            QueryParseException
Init this file filter with the query already built and parsed.

Parameters:
q - The query.
Throws:
IllegalStateException - If the Query object has not been parsed.
QueryParseException - If the FROM class is not File.
Method Detail

setJoSQLFileFilter

public void setJoSQLFileFilter(JoSQLFileFilter ff)
Set the JoSQLFileFilter that should be used to handle the accept(File) method.

Parameters:
ff - The file filter.

setDescription

public void setDescription(String d)
Set the description that should be used.

Parameters:
d - The description.

getDescription

public String getDescription()
Return the description for the filter.

Specified by:
getDescription in class FileFilter
Returns:
The description.

getJoSQLFileFilter

public JoSQLFileFilter getJoSQLFileFilter()
Get the file filter being used "under the hoodie" in the accept(File) method. You should also check that file filter to see if an exception has occurred.

Returns:
The JoSQLFileFilter that is being used to perform the match.

accept

public boolean accept(File f)
Apply the WHERE clause of the statement to the File passed in. This is just a wrapper call to: JoSQLFileFilter.accept(File).

Specified by:
accept in class FileFilter
Parameters:
f - The file to evaluate the WHERE on.
Returns:
true if the WHERE clause evaluates to true.


  Copyright © 2008 Gary Bentley. All Rights Reserved.