org.proteinshader.structure.io.filters
Class PDBFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by org.proteinshader.structure.io.filters.PDBFileFilter

public class PDBFileFilter
extends FileFilter

Checks if a file has a ".pdb" file ending.

Java's class javax.swing.filechooser.FileFilter is abstract and requires a subclass to define a boolean accept( File ) method and a getDescription() method. An example of how to create a FileFilter for image files can be found at Filtering the List of Files in the sun tutorial pages.


Constructor Summary
PDBFileFilter()
          Constructs a PDBFileFilter.
 
Method Summary
 boolean accept(File file)
          Returns true if the file is a directory or has a "pdb" extension.
 String getDescription()
          Constructs a PDBFileFilter.
 String getFilenameExtension(File file)
          Obtains the filename extension (the letters after last '.') if it exists and return it as lowercase letters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDBFileFilter

public PDBFileFilter()
Constructs a PDBFileFilter.

Method Detail

getDescription

public String getDescription()
Constructs a PDBFileFilter.

Specified by:
getDescription in class FileFilter

accept

public boolean accept(File file)
Returns true if the file is a directory or has a "pdb" extension. Otherwise, returns false.

Specified by:
accept in class FileFilter
Parameters:
file - the file to test.
Returns:
True for a directory or a file ending in ".pdb".

getFilenameExtension

public String getFilenameExtension(File file)
Obtains the filename extension (the letters after last '.') if it exists and return it as lowercase letters.

Parameters:
file - the file to get the filename extension from.
Returns:
The file extension (or null if it does not exist).


Copyright © 2007-2008