com.metamatrix.common.tree.directory
Class FileSystemFilter

java.lang.Object
  extended by com.metamatrix.common.tree.directory.FileSystemFilter
All Implemented Interfaces:
DirectoryEntryFilter, TreeNodeFilter

public class FileSystemFilter
extends java.lang.Object
implements DirectoryEntryFilter

A sloppy filter to be used for test purposes only. Will work with a FileSystemView and will filter based on the extensions of the files. The filter will return files matching the supplied extensions AND all directories. As a side effect, it will also return files with no extensions. But, hey, it's a testing tool. If you need a real filter, build your own.


Constructor Summary
FileSystemFilter(FileSystemView fsv, java.lang.String[] extensions, java.lang.String description)
           
 
Method Summary
 boolean accept(TreeNode entry)
          Determine whether the given TreeNode is accepted by this filter.
 java.lang.String getDescription()
          Obtain a description for this filter.
 java.lang.String getExtension(int index)
           
 int getExtensionCount()
           
static java.lang.String getFileNameExtension(java.lang.String s)
          Return the extension portion of the file's name .
 void setDescription(java.lang.String s)
          Obtain a description for this filter.
 void setTreeNodeEditor(TreeNodeEditor editor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemFilter

public FileSystemFilter(FileSystemView fsv,
                        java.lang.String[] extensions,
                        java.lang.String description)
Method Detail

getFileNameExtension

public static java.lang.String getFileNameExtension(java.lang.String s)
Return the extension portion of the file's name .

See Also:
getExtension(int), FileFilter#accept

setTreeNodeEditor

public void setTreeNodeEditor(TreeNodeEditor editor)

setDescription

public void setDescription(java.lang.String s)
Obtain a description for this filter.


getDescription

public java.lang.String getDescription()
Obtain a description for this filter.

Specified by:
getDescription in interface TreeNodeFilter
Returns:
the readable description. For example: "JPG and GIF Images"

accept

public boolean accept(TreeNode entry)
Determine whether the given TreeNode is accepted by this filter.

Specified by:
accept in interface TreeNodeFilter
Returns:
true if accepted, or false otherwise.

getExtension

public java.lang.String getExtension(int index)
Specified by:
getExtension in interface DirectoryEntryFilter

getExtensionCount

public int getExtensionCount()
Specified by:
getExtensionCount in interface DirectoryEntryFilter


Copyright © 2009. All Rights Reserved.