1 | // |
---|
2 | // $Id: JUploadFileFilter.java 95 2007-05-02 03:27:05Z |
---|
3 | // /C=DE/ST=Baden-Wuerttemberg/O=ISDN4Linux/OU=Fritz |
---|
4 | // Elfert/CN=svn-felfert@isdn4linux.de/emailAddress=fritz@fritz-elfert.de $ |
---|
5 | // |
---|
6 | // jupload - A file upload applet. |
---|
7 | // Copyright 2007 The JUpload Team |
---|
8 | // |
---|
9 | // Created: ? |
---|
10 | // Creator: William JinHua Kwong |
---|
11 | // Last modified: $Date: 2008-08-08 18:53:52 -0300 (Sex, 08 Ago 2008) $ |
---|
12 | // |
---|
13 | // This program is free software; you can redistribute it and/or modify it under |
---|
14 | // the terms of the GNU General Public License as published by the Free Software |
---|
15 | // Foundation; either version 2 of the License, or (at your option) any later |
---|
16 | // version. This program is distributed in the hope that it will be useful, but |
---|
17 | // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
18 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
---|
19 | // details. You should have received a copy of the GNU General Public License |
---|
20 | // along with this program; if not, write to the Free Software Foundation, Inc., |
---|
21 | // 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
22 | |
---|
23 | package wjhk.jupload2.gui; |
---|
24 | |
---|
25 | import java.io.File; |
---|
26 | |
---|
27 | import javax.swing.filechooser.FileFilter; |
---|
28 | |
---|
29 | import wjhk.jupload2.policies.UploadPolicy; |
---|
30 | |
---|
31 | /** |
---|
32 | * Default File Filter used by the |
---|
33 | * {@link wjhk.jupload2.policies.DefaultUploadPolicy} to filter the allowed file |
---|
34 | * in the JFileChooser. This class is an empty one: it just calls the { |
---|
35 | */ |
---|
36 | public class JUploadFileFilter extends FileFilter { |
---|
37 | |
---|
38 | UploadPolicy uploadPolicy = null; |
---|
39 | |
---|
40 | JUploadFileFilter(UploadPolicy uploadPolicy) { |
---|
41 | this.uploadPolicy = uploadPolicy; |
---|
42 | } |
---|
43 | |
---|
44 | /** |
---|
45 | * @see javax.swing.filechooser.FileFilter#accept(java.io.File) |
---|
46 | */ |
---|
47 | @Override |
---|
48 | public boolean accept(File file) { |
---|
49 | return this.uploadPolicy.fileFilterAccept(file); |
---|
50 | } |
---|
51 | |
---|
52 | /** |
---|
53 | * @see javax.swing.filechooser.FileFilter#getDescription() |
---|
54 | */ |
---|
55 | @Override |
---|
56 | public String getDescription() { |
---|
57 | return this.uploadPolicy.fileFilterGetDescription(); |
---|
58 | } |
---|
59 | |
---|
60 | } |
---|