@Test public void testAcceptFile() { File rdfFile = new File("test.rdf"); File xmlFile = new File("test.xml"); File textFile = new File("test.txt"); assertTrue(filter.accept(rdfFile)); assertTrue(filter.accept(xmlFile)); assertFalse(filter.accept(textFile)); }
@Override public boolean accept(final File file) { if (file.isDirectory()) return true; final String fileName = file.getName().toLowerCase(); if (extensions != null) { for (int i = 0; i < extensions.length; i++) { if (fileName.endsWith(extensions[i])) return true; } } else throw new IllegalArgumentException("No fileType specified"); return false; }
FileChooserFilter extends FileFilter { @Override public boolean accept(final File file) { if (file.isDirectory()) return true; final String fileName = file.getName().toLowerCase(); if (extensions != null) { for (int i = 0; i < extensions.length; i++) { if (fileName.endsWith(extensions[i])) return true; } } else throw new IllegalArgumentException("No fileType specified"); return false; } }
FileChooserFilter extends FileFilter { @Override public boolean accept(final File file) { if (file.isDirectory()) return true; final String fileName = file.getName().toLowerCase(); if (extensions != null) { for (int i = 0; i < extensions.length; i++) { if (fileName.endsWith(extensions[i])) return true; } } else throw new IllegalArgumentException("No fileType specified"); return false; } FileChooserFilter(final String description, final String extension);  FileChooserFilter(final String description, final String[] extensions); }
FileChooserFilter extends FileFilter { @Override public boolean accept(final File file) { if (file.isDirectory()) return true; final String fileName = file.getName().toLowerCase(); if (extensions != null) { for (int i = 0; i < extensions.length; i++) { if (fileName.endsWith(extensions[i])) return true; } } else throw new IllegalArgumentException("No fileType specified"); return false; } FileChooserFilter(final String description, final String extension);  FileChooserFilter(final String description, final String[] extensions); @Override boolean accept(final File file); @Override String getDescription(); String[] getExtensions(); @Override boolean equals(final Object other); }
FileChooserFilter extends FileFilter { @Override public boolean accept(final File file) { if (file.isDirectory()) return true; final String fileName = file.getName().toLowerCase(); if (extensions != null) { for (int i = 0; i < extensions.length; i++) { if (fileName.endsWith(extensions[i])) return true; } } else throw new IllegalArgumentException("No fileType specified"); return false; } FileChooserFilter(final String description, final String extension);  FileChooserFilter(final String description, final String[] extensions); @Override boolean accept(final File file); @Override String getDescription(); String[] getExtensions(); @Override boolean equals(final Object other);  }