-/*\r
-GNU Lesser General Public License\r
-\r
-MutableFilter\r
-Copyright (C) 2000-2003 Howard Kistler\r
-\r
-This library is free software; you can redistribute it and/or\r
-modify it under the terms of the GNU Lesser General Public\r
-License as published by the Free Software Foundation; either\r
-version 2.1 of the License, or (at your option) any later version.\r
-\r
-This library is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
-Lesser General Public License for more details.\r
-\r
-You should have received a copy of the GNU Lesser General Public\r
-License along with this library; if not, write to the Free Software\r
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-*/\r
-\r
-package com.hexidec.ekit.component;\r
-\r
-import java.io.File;\r
-import javax.swing.filechooser.FileFilter;\r
-\r
-/** Class for providing JFileChooser with a FileFilter\r
- */\r
-public class MutableFilter extends FileFilter\r
-{\r
- private String[] acceptableExtensions;\r
- private String descriptor;\r
-\r
- public MutableFilter(String[] exts, String desc)\r
- {\r
- acceptableExtensions = exts;\r
- StringBuffer strbDesc = new StringBuffer(desc + " (");\r
- for(int i = 0; i < acceptableExtensions.length; i++)\r
- {\r
- if(i > 0) { strbDesc.append(", "); }\r
- strbDesc.append("*." + acceptableExtensions[i]);\r
- }\r
- strbDesc.append(")");\r
- descriptor = strbDesc.toString();\r
- }\r
-\r
- public boolean accept(File file)\r
- {\r
- if(file.isDirectory())\r
- {\r
- return true;\r
- }\r
- String fileName = file.getName();\r
- String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()).toLowerCase();\r
- if(fileExt != null)\r
- {\r
- for(int i = 0; i < acceptableExtensions.length; i++)\r
- {\r
- if(fileExt.equals(acceptableExtensions[i]))\r
- {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
- else\r
- {\r
- return false;\r
- }\r
- }\r
-\r
- public String getDescription()\r
- {\r
- return descriptor;\r
- }\r
-}\r
-\r
+/*
+GNU Lesser General Public License
+
+MutableFilter
+Copyright (C) 2000 Howard Kistler
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+package com.hexidec.ekit.component;
+
+import java.io.File;
+import javax.swing.filechooser.FileFilter;
+
+/** Class for providing JFileChooser with a FileFilter
+ */
+public class MutableFilter extends FileFilter
+{
+ private String[] acceptableExtensions;
+ private String descriptor;
+
+ public MutableFilter(String[] exts, String desc)
+ {
+ acceptableExtensions = exts;
+ StringBuffer strbDesc = new StringBuffer(desc + " (");
+ for(int i = 0; i < acceptableExtensions.length; i++)
+ {
+ if(i > 0) { strbDesc.append(", "); }
+ strbDesc.append("*." + acceptableExtensions[i]);
+ }
+ strbDesc.append(")");
+ descriptor = strbDesc.toString();
+ }
+
+ public boolean accept(File file)
+ {
+ if(file.isDirectory())
+ {
+ return true;
+ }
+ String fileName = file.getName();
+ String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()).toLowerCase();
+ if(fileExt != null)
+ {
+ for(int i = 0; i < acceptableExtensions.length; i++)
+ {
+ if(fileExt.equals(acceptableExtensions[i]))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public String getDescription()
+ {
+ return descriptor;
+ }
+}
+