Class FormatFileFilter

java.lang.Object
javax.swing.filechooser.FileFilter
loci.formats.gui.FormatFileFilter
All Implemented Interfaces:
FileFilter, Comparable

public class FormatFileFilter extends FileFilter implements FileFilter, Comparable
A file filter for a biological file format, for use with a JFileChooser.
  • Field Details

    • reader

      private IFormatReader reader
      Associated file format reader.
    • allowOpen

      private boolean allowOpen
      Whether it is ok to open a file to determine its type.
    • desc

      private String desc
      Description.
  • Constructor Details

    • FormatFileFilter

      public FormatFileFilter(IFormatReader reader)
      Constructs a new filter that accepts files of the given reader's type.
    • FormatFileFilter

      public FormatFileFilter(IFormatReader reader, boolean allowOpen)
      Constructs a new filter that accepts files of the given reader's type, allowing the reader to open files only if the allowOpen flag is set.
      Parameters:
      reader - The reader to use for verifying a file's type.
      allowOpen - Whether it is ok to open a file to determine its type.
  • Method Details

    • accept

      public boolean accept(File f)
      Accepts files in accordance with the file format reader.
      Specified by:
      accept in interface FileFilter
      Specified by:
      accept in class FileFilter
    • getReader

      public IFormatReader getReader()
      Returns the filter's reader.
    • getDescription

      public String getDescription()
      Gets the filter's description.
      Specified by:
      getDescription in class FileFilter
    • toString

      public String toString()
      Gets a string representation of this file filter.
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(Object o)
      Compares two FileFilter objects alphanumerically.
      Specified by:
      compareTo in interface Comparable