JAPI 0.9.0
Yet another Java API
API Documentation

net.sf.japi.util.filter.file
Class EndingFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by net.sf.japi.util.filter.file.AbstractFileFilter
          extended by net.sf.japi.util.filter.file.EndingFileFilter
All Implemented Interfaces:
FileFilter, Filter<File>

public class EndingFileFilter
extends AbstractFileFilter

Swing FileFilter implementation that filters files with specified endings.

Author:
Christian Hujer
Todo:
find a convenient way for i18n/l10n of this class, option to ignore case

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.japi.util.filter.Filter
Filter.Factory
 
Constructor Summary
EndingFileFilter(boolean acceptDirectories, boolean negate, String description, String... endings)
          Create an EndingFileFilter.
EndingFileFilter(boolean acceptDirectories, String description, String... endings)
          Create an EndingFileFilter.
 
Method Summary
 boolean accept(File pathname)
          Whether the given file is accepted by this filter.
 String getDescription()
          The description of this filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EndingFileFilter

public EndingFileFilter(boolean acceptDirectories,
                        String description,
                        String... endings)
Create an EndingFileFilter. negate is set to false on this file filter.

Parameters:
acceptDirectories - pass true if this FileFilter should accept directories as well, false to deny directories
description - The description to use for swing
endings - The endings to accept, including their period Example: new EndingFileFilter(false, "jpeg image files", ".jpg", ".jpeg", ".jfif")

EndingFileFilter

public EndingFileFilter(boolean acceptDirectories,
                        boolean negate,
                        String description,
                        String... endings)
Create an EndingFileFilter.

Parameters:
acceptDirectories - pass true if this FileFilter should accept directories as well, false to deny directories
negate - pass true if the endings are to be negated, which means the filter will only accept files not ending on one of the endings; usually you want to pass false
description - The description to use for swing
endings - The endings to accept, including their period Example: new EndingFileFilter(false, true, "all files but jpeg image files", ".jpg", ".jpeg", ".jfif")
Method Detail

getDescription

public final String getDescription()
The description of this filter. For example: "JPG and GIF Images"

Specified by:
getDescription in class FileFilter
See Also:
FileView.getName(java.io.File)

accept

public boolean accept(File pathname)
Whether the given file is accepted by this filter.

Specified by:
accept in interface FileFilter
Specified by:
accept in interface Filter<File>
Specified by:
accept in class FileFilter
Parameters:
pathname - The abstract pathname to be tested
Returns:
true if and only if pathname should be included

JAPI
Yet another Java API
API Documentation

© 2005-2006 Christian Hujer. All rights reserved. See copyright