KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > memoire > vainstall > builder > util > VAIProjectFileFilter


1 /*
2  * $RCSfile: VAIProjectFileFilter.java,v $
3  * @modification $Date: 2001/09/28 19:41:42 $
4  * @version $Id: VAIProjectFileFilter.java,v 1.1 2001/09/28 19:41:42 hfalk Exp $
5  *
6  */

7
8 package com.memoire.vainstall.builder.util;
9
10 import java.io.File JavaDoc;
11
12 import javax.swing.filechooser.FileFilter JavaDoc;
13
14 /**
15  * This is a FileFilter which only allows VAInstall builder project
16  * files to be selected.
17  *
18  * @see javax.swing.filechooser.FileFilter
19  *
20  * @author Henrik Falk
21  * @version $Id: VAIProjectFileFilter.java,v 1.1 2001/09/28 19:41:42 hfalk Exp $
22  */

23 public class VAIProjectFileFilter extends FileFilter JavaDoc {
24
25     /**
26      * Default constructor
27      */

28     public VAIProjectFileFilter() {
29         super();
30     }
31
32     /**
33      * Implements the accept method for the FileFilter
34      * @param file The file provided by the FileChooser
35      * @return true if the file is accepted by the filter
36      */

37     public boolean accept(File JavaDoc file){
38
39         // we allow to browse through directories
40
if (file.isDirectory()) {
41             return true;
42         }
43
44         // allow only 'vainstall.xml' files
45
if (file.getName().equals("vainstall.xml") == true) {
46             return true;
47         }
48         return false;
49     }
50
51     /**
52      * Returns the description of the filefilter to the filechooser
53      * @return The description of this filefilter.
54      */

55     public String JavaDoc getDescription() {
56         return "VAInstall Project Files (vainstall.xml)";
57     }
58
59 }
60
Popular Tags