01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.client.gui.image;
19:
20: import java.io.File;
21:
22: import javax.swing.filechooser.FileFilter;
23:
24: import de.finix.contelligent.client.gui.file.Utils;
25: import de.finix.contelligent.client.i18n.Resources;
26:
27: public class ImageFilter extends FileFilter {
28:
29: // Accept all directories and all gif, jpg, or tiff files.
30: public boolean accept(File f) {
31: if (f.isDirectory()) {
32: return true;
33: }
34:
35: String extension = Utils.getExtension(f);
36: if (extension != null) {
37: if (extension.equals(Utils.tiff)
38: || extension.equals(Utils.tif)
39: || extension.equals(Utils.gif)
40: || extension.equals(Utils.png)
41: || extension.equals(Utils.jpeg)
42: || extension.equals(Utils.jpg)) {
43: return true;
44: } else {
45: return false;
46: }
47: }
48:
49: return false;
50: }
51:
52: // The description of this filter
53: public String getDescription() {
54: return Resources.getLocalString("imgage_filter_description");
55: }
56: }
|