KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > webdocwf > util > loader > wizard > XmlFilter


1 /*
2 LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
3
4
5     Copyright (C) 2003 Together
6
7     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Lesser General Public
9     License as published by the Free Software Foundation; either
10     version 2.1 of the License, or (at your option) any later version.
11
12     This library is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15     Lesser General Public License for more details.
16
17     You should have received a copy of the GNU Lesser General Public
18     License along with this library; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */

21
22 package org.webdocwf.util.loader.wizard;
23
24 import java.io.File JavaDoc;
25
26 /**
27  * DomlFilter restricts file sets to only those files that are
28  * .doml files. Use this with JFileChooser to create a directory
29  * chooser.
30  *
31  *
32  * @author Radoslav Dutina
33  */

34 public class XmlFilter extends javax.swing.filechooser.FileFilter JavaDoc {
35
36     /**
37      * Create a DomlFilter for use with the FileChooser dialog.
38      */

39     public XmlFilter() {}
40
41     /**
42      * Check to see if the passed file is a directory.
43      *
44      * @param f File to check.
45      *
46      * @return True if the file is a doml file (.doml).
47      *
48      */

49     public boolean accept(File JavaDoc f) {
50         return f.getName().endsWith(".xml") || f.isDirectory();
51     }
52
53     /**
54      * Get a description of this filter.
55      *
56      * @return The description of this filter.
57      *
58      */

59     public String JavaDoc getDescription() {
60         return new String JavaDoc(".xml");
61     }
62 }
63
Popular Tags