Class TerpPaintFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by TerpPaintFileFilter

public class TerpPaintFileFilter
extends javax.swing.filechooser.FileFilter

TerpPaintFileFilter class creates a file filter. If no filters are added, then all files are accepted. It should work with all operating systems and hardware. The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.


Field Summary
private  java.lang.String description
          String which is used for the description of the file.
private  java.util.Hashtable filters
          Hashtable which is used to store the filters.
private  java.lang.String fullDescription
          String for the full description of the file.
private static java.lang.String HIDDEN_FILE
          String representing hidden file.
private static java.lang.String TYPE_UNKNOWN
          String representing unknown file type.
private  boolean useExtensionsInDescription
          True if the description contains a extension and is false if the description does not contain an extension.
 
Constructor Summary
TerpPaintFileFilter()
          Constructor of TerpPaintFileFilter.
TerpPaintFileFilter(java.lang.String extension)
          This function creates a file filter that accepts files with the given extension.
TerpPaintFileFilter(java.lang.String[] filters)
          This function creates a file filter from the given string array.
TerpPaintFileFilter(java.lang.String[] filters, java.lang.String description)
          This function creates a file filter from the given string array and description.
TerpPaintFileFilter(java.lang.String extension, java.lang.String description)
          This function creates a file filter that accepts the given file type.
 
Method Summary
 boolean accept(java.io.File f)
          Return true if this file should be shown in the directory pane, false if it shouldn't.
 void addExtension(java.lang.String extension)
          Adds a filetype "dot" extension to filter against.
 java.lang.String getDescription()
          This function returns a String of the human readable description of this filter.
 java.lang.String getExtension(java.io.File f)
          This method returns a String object of the extension portion of the file's name.
 boolean isExtensionListInDescription()
          This function returns whether the extension list (.jpg, .gif, etc) should show up in the human readable description.
 void setDescription(java.lang.String description)
          Sets the human readable description of this filter.
 void setExtensionListInDescription(boolean b)
          This function determines whether the extension list (.jpg, .gif, etc) 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
 

Field Detail

TYPE_UNKNOWN

private static java.lang.String TYPE_UNKNOWN
String representing unknown file type.


HIDDEN_FILE

private static java.lang.String HIDDEN_FILE
String representing hidden file.


filters

private java.util.Hashtable filters
Hashtable which is used to store the filters.


description

private java.lang.String description
String which is used for the description of the file.


fullDescription

private java.lang.String fullDescription
String for the full description of the file.


useExtensionsInDescription

private boolean useExtensionsInDescription
True if the description contains a extension and is false if the description does not contain an extension.

Constructor Detail

TerpPaintFileFilter

public TerpPaintFileFilter()
Constructor of TerpPaintFileFilter. It initializes the filter hashtable and creates a new hashtable to filter the file. The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.


TerpPaintFileFilter

public TerpPaintFileFilter(java.lang.String extension)
This function creates a file filter that accepts files with the given extension. Example: new ExampleFileFilter("jpg"); The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.

Parameters:
extension - String that describes the type of file extension.

TerpPaintFileFilter

public TerpPaintFileFilter(java.lang.String extension,
                           java.lang.String description)
This function creates a file filter that accepts the given file type. Example: new ExampleFileFilter("jpg", "JPEG Image Images"); Note that the "." before the extension is not needed. If provided, it will be ignored. The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.

Parameters:
extension - String that represents the type of the image file.
description - String used to for the description.

TerpPaintFileFilter

public TerpPaintFileFilter(java.lang.String[] filters)
This function creates a file filter from the given string array. Example: new ExampleFileFilter(String {"gif", "jpg"}); Note that the "." before the extension is not needed adn will be ignored. The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.

Parameters:
filters - an Array of String to be used for filters.

TerpPaintFileFilter

public TerpPaintFileFilter(java.lang.String[] filters,
                           java.lang.String description)
This function creates a file filter from the given string array and description. Example: new ExampleFileFilter(String {"gif", "jpg"}, "Gif and JPG Images"); Note that the "." before the extension is not needed and will be ignored. The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.

Parameters:
filters - an array of String to be used for filters.
description - a String to be used for description of the file.
Method Detail

accept

public boolean accept(java.io.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. The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.

Specified by:
accept in class javax.swing.filechooser.FileFilter
Parameters:
f - File object that contains image.
Returns:
return true if f is in directory or if the extension of the file is not null and the hashtable filter is not null, else return false.

getExtension

public java.lang.String getExtension(java.io.File f)
This method returns a String object of the extension portion of the file's name. The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.

Parameters:
f - a File that contains the image.
Returns:
return the file extension and if it is null, return null.

addExtension

public void addExtension(java.lang.String extension)
Adds a filetype "dot" extension to filter against. For example: the following code will create a filter that filters out all files except those that end in ".jpg" and ".tif": ExampleFileFilter filter = new ExampleFileFilter(); filter.addExtension("jpg"); filter.addExtension("tif"); The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification. Note that the "." before the extension is not needed and will be ignored.

Parameters:
extension - a String to be added to the end of file as a representation of the file extension.

getDescription

public java.lang.String getDescription()
This function returns a String of the human readable description of this filter. For example: "JPEG and GIF Image Files (*.jpg, *.gif)". The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.

Specified by:
getDescription in class javax.swing.filechooser.FileFilter
Returns:
returns the full description of the file.
See Also:
setDescription(java.lang.String)

setDescription

public void setDescription(java.lang.String description)
Sets the human readable description of this filter. For example: filter.setDescription("Gif and JPG Images"); The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.

Parameters:
description - a String used to describe the file information.
See Also:
getDescription()

setExtensionListInDescription

public void setExtensionListInDescription(boolean b)
This function determines whether the extension list (.jpg, .gif, etc) should show up in the human readable description. Only relevent if a description was provided in the constructor or using setDescription(); The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.

Parameters:
b - a boolean value determines true or false of useExtensionInDescription status.

isExtensionListInDescription

public boolean isExtensionListInDescription()
This function returns whether the extension list (.jpg, .gif, etc) should show up in the human readable description. It returns a boolean value. Only relevent if a description was provided in the constructor or using setDescription(); The OS is windows. There is no implementation variances. There is no security constaints. There is no external secification.

Returns:
returns a boolean value which is the private bool useExtensionsInDescription.