org.graffiti.core
Class MultiFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by org.graffiti.core.MultiFileFilter

public class MultiFileFilter
extends FileFilter

This file filter allows showing more than one file extension in a filechooser dialog.

Version:
$Revision 1.0$ $Date: 2010-05-07 20:42:02 +0200 (Fri, 07 May 2010) $
Author:
Marek Piorkowski

Constructor Summary
MultiFileFilter()
          Creates a file filter.
MultiFileFilter(String extension)
          Creates a file filter that accepts files with the given extension.
MultiFileFilter(String[] filters)
          Creates a file filter from the given string array.
MultiFileFilter(String[] filters, String description)
          Creates a file filter from the given string array and description.
MultiFileFilter(String extension, String description)
          Creates a file filter that accepts the given file type.
 
Method Summary
 boolean accept(File f)
          Return true if this file should be shown in the directory pane, false if it shouldn't.
 void addExtension(String extension)
          Adds a filetype "dot" extension to filter against.
 String[] getAllExtensions()
          Returns all extensions in an array.
 String getDescription()
          Returns the human readable description of this filter.
 String getExtension(File f)
          Return the extension portion of the file's name .
 boolean isExtensionListInDescription()
          Returns whether the extension list should show up in the human readable description.
 void setDescription(String description)
          Sets the human readable description of this filter.
 void setExtensionListInDescription(boolean b)
          Determines whether the extension list should show up in the human readable description.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiFileFilter

public MultiFileFilter()
Creates a file filter. If no filters are added, then all files are accepted.


MultiFileFilter

public MultiFileFilter(String extension)
Creates a file filter that accepts files with the given extension.


MultiFileFilter

public MultiFileFilter(String extension,
                       String description)
Creates a file filter that accepts the given file type. Note that the "." before the extension is not needed. If provided, it will be ignored.


MultiFileFilter

public MultiFileFilter(String[] filters)
Creates a file filter from the given string array. Note that the "." before the extension is not needed adn will be ignored.


MultiFileFilter

public MultiFileFilter(String[] filters,
                       String description)
Creates a file filter from the given string array and description. Note that the "." before the extension is not needed and will be ignored.

Method Detail

accept

public boolean accept(File f)
Return true if this file should be shown in the directory pane, false if it shouldn't. Files that begin with "." are ignored.

Specified by:
accept in class FileFilter

getExtension

public String getExtension(File f)
Return the extension portion of the file's name .


getAllExtensions

public String[] getAllExtensions()
Returns all extensions in an array.

Returns:
All extensions in an array.

addExtension

public void addExtension(String extension)
Adds a filetype "dot" extension to filter against. Note that the "." before the extension will be ignored. So both, ".xxx" and "xxx" will be accepted here.


getDescription

public String getDescription()
Returns the human readable description of this filter.

Specified by:
getDescription in class FileFilter

setDescription

public void setDescription(String description)
Sets the human readable description of this filter.


setExtensionListInDescription

public void setExtensionListInDescription(boolean b)
Determines whether the extension list should show up in the human readable description. Only relevent if a description was provided in the constructor or using setDescription();


isExtensionListInDescription

public boolean isExtensionListInDescription()
Returns whether the extension list should show up in the human readable description. Only relevent if a description was provided in the constructor or using setDescription();



Generated at 2012-05-30 11:00:36 PM CEST