KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > userinterface > ExtensionFilter


1 package com.calipso.reportgenerator.userinterface;
2
3 import javax.swing.filechooser.FileFilter JavaDoc;
4 import java.io.File JavaDoc;
5 /**
6  * Esta clase filtra los archivos por extension , donde pondra visible aquelos que tengan extension .xml
7  */

8
9 public class ExtensionFilter extends FileFilter JavaDoc{
10   private String JavaDoc extension;
11   private String JavaDoc description;
12
13 /**
14  * Crea un objeto ExtensionFilter
15  * @param extension
16  * @param description
17  */

18
19   public ExtensionFilter(String JavaDoc extension , String JavaDoc description) {
20     this.extension = extension;
21     this.description = description;
22   }
23
24   /**
25    * Retorna si el file es un directorio o la extension es xml.
26    * @param file
27    * @return
28    */

29   public boolean accept(File JavaDoc file) {
30     return (file.isDirectory() || file.getName().toLowerCase().endsWith(extension));
31   }
32
33   /**
34    * retorna la descripcion del file
35    * @return
36    */

37   public String JavaDoc getDescription() {
38     return description;
39   }
40 }
41
Popular Tags