View Javadoc

1   package com.melloware.jukes.file.filter;
2   
3   import java.io.File;
4   
5   import javax.swing.filechooser.FileFilter;
6   
7   import org.apache.commons.io.FilenameUtils;
8   
9   /**
10   * Filters for disclist files in JFileChooser.  Such as .lst files.
11   * <p>
12   * Copyright (c) 1999-2007 Melloware, Inc. <http://www.melloware.com>
13   * @author Emil A. Lefkof III <info@melloware.com>
14   * @version 4.0
15   * AZ Development 2009
16   */
17  public final class DisclistFilter
18      extends FileFilter {
19  
20      public static final String lst = "lst";
21      public static final String[] EXTENSIONS = new String[] { lst };
22  
23      /**
24       * Default Constuctor
25       */
26      public DisclistFilter() {
27          super();
28      }
29  
30      /* (non-Javadoc)
31       * @see javax.swing.filechooser.FileFilter#getDescription()
32       */
33      public String getDescription() {
34          return "Disclist Files (*.lst)";
35      }
36  
37      /**
38       * Accept all files such as .lst.
39       * <p>
40       * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
41       */
42      public boolean accept(File aFile) {
43          if (aFile.isDirectory()) {
44              return true;
45          }
46  
47          return FilenameUtils.isExtension(aFile.getName().toLowerCase(), EXTENSIONS);
48      }
49  
50  }