1 18 package org.apache.batik.apps.svgbrowser; 19 20 import java.io.File ; 21 22 import javax.swing.filechooser.FileFilter ; 23 24 30 public class SquiggleInputHandlerFilter extends FileFilter { 31 protected SquiggleInputHandler handler; 32 33 public SquiggleInputHandlerFilter(SquiggleInputHandler handler) { 34 this.handler = handler; 35 } 36 37 public boolean accept(File f) { 38 return f.isDirectory() || handler.accept(f); 39 } 40 41 public String getDescription() { 42 StringBuffer sb = new StringBuffer (); 43 String extensions[] = handler.getHandledExtensions(); 44 int n = extensions != null ? extensions.length : 0; 45 for (int i=0; i<n; i++) { 46 if (i > 0) { 47 sb.append(", "); 48 } 49 sb.append(extensions[i]); 50 } 51 52 if (n > 0) { 53 sb.append(" "); 54 } 55 56 sb.append(handler.getDescription()); 57 return sb.toString(); 58 } 59 } 60 | Popular Tags |