1 19 package org.openharmonise.him.editors.filefilters; 20 21 import java.io.File ; 22 23 import javax.swing.filechooser.FileFilter ; 24 25 32 public class CSVFilter extends FileFilter { 33 34 public static final String DESCRIPTION = "CSV"; 35 36 39 public CSVFilter() { 40 super(); 41 } 42 43 46 public boolean accept(File file) { 47 boolean bAccept = false; 48 49 if (file.isDirectory()) { 50 bAccept = true; 51 } 52 String sFilename = file.getName(); 53 if (sFilename.indexOf(".") > 0) { 54 String sExt = sFilename.substring(sFilename.indexOf(".") + 1); 55 if (sExt.length() > 0) { 56 if (sExt.equalsIgnoreCase("csv")) { 57 bAccept = true; 58 } 59 } 60 } 61 return bAccept; 62 } 63 64 67 public String getDescription() { 68 return DESCRIPTION; 69 } 70 71 } 72 | Popular Tags |