View Javadoc
1   //
2   // $Id$
3   //
4   // jupload - A file upload applet.
5   //
6   // Copyright 2010 The JUpload Team
7   //
8   // Created: 9 fevr. 2010
9   // Creator: etienne_sf
10  // Last modified: $Date$
11  //
12  // This program is free software; you can redistribute it and/or modify
13  // it under the terms of the GNU General Public License as published by
14  // the Free Software Foundation; either version 2 of the License, or
15  // (at your option) any later version.
16  //
17  // This program is distributed in the hope that it will be useful,
18  // but WITHOUT ANY WARRANTY; without even the implied warranty of
19  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  // GNU General Public License for more details.
21  //
22  // You should have received a copy of the GNU General Public License
23  // along with this program; if not, write to the Free Software
24  // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  package wjhk.jupload2.testhelpers;
26  
27  import java.awt.Color;
28  import java.awt.Component;
29  import java.awt.Font;
30  import java.awt.Point;
31  import java.io.File;
32  import java.util.ArrayList;
33  import java.util.List;
34  
35  import javax.swing.ActionMap;
36  import javax.swing.TransferHandler;
37  
38  import org.apache.log4j.Logger;
39  
40  import wjhk.jupload2.filedata.FileData;
41  import wjhk.jupload2.gui.filepanel.FilePanel;
42  
43  /**
44   * @author etienne_sf
45   */
46  public class FilePanelTestHelper implements FilePanel {
47  
48      // Checkers, to verify that specific methods have been called.
49      public int removeFileNotToUpload_NbCalls = 0;
50  
51      /** Logger for this class */
52      protected final Logger logger = Logger.getLogger(getClass());
53  
54      /** List of files that this class is 'filepanel' contains */
55      public List<FileData> filesToUpload = new ArrayList<FileData>();
56  
57      /**
58       * @param filesToUpload
59       */
60      public FilePanelTestHelper(List<FileData> filesToUpload) {
61          this.filesToUpload = filesToUpload;
62      }
63  
64      /**
65       * @see wjhk.jupload2.gui.filepanel.FilePanel#addFiles(java.io.File[], java.io.File)
66       */
67      public void addFiles(File[] f) {
68          throw new UnsupportedOperationException(this.getClass() + ".addFiles() is not implemented in tests cases");
69      }
70  
71      /**
72       * @see wjhk.jupload2.gui.filepanel.FilePanel#clearSelection()
73       */
74      public void clearSelection() {
75          throw new UnsupportedOperationException(this.getClass() + ".clearSelection() is not implemented in tests cases");
76      }
77  
78      /**
79       * @see wjhk.jupload2.gui.filepanel.FilePanel#focusTable()
80       */
81      public void focusTable() {
82          throw new UnsupportedOperationException(this.getClass() + ".focusTable() is not implemented in tests cases");
83      }
84  
85      /**
86       * @see wjhk.jupload2.gui.filepanel.FilePanel#getActionMap()
87       */
88      public ActionMap getActionMap() {
89          throw new UnsupportedOperationException(this.getClass() + ".getActionMap() is not implemented in tests cases");
90      }
91  
92      /**
93       * @see wjhk.jupload2.gui.filepanel.FilePanel#getDropComponent()
94       */
95      public Component getDropComponent() {
96          throw new UnsupportedOperationException(this.getClass()
97                  + ".getDropComponent() is not implemented in tests cases");
98      }
99  
100     /**
101      * @see wjhk.jupload2.gui.filepanel.FilePanel#getFileDataAt(java.awt.Point)
102      */
103     public FileData getFileDataAt(Point point) {
104         throw new UnsupportedOperationException(this.getClass() + ".getFileDataAt() is not implemented in tests cases");
105     }
106 
107     /**
108      * @see wjhk.jupload2.gui.filepanel.FilePanel#getFiles()
109      */
110     public List<FileData> getFiles() {
111         return (this.filesToUpload);
112     }
113 
114     /**
115      * @see wjhk.jupload2.gui.filepanel.FilePanel#getFilesLength()
116      */
117     public int getFilesLength() {
118         return this.filesToUpload.size();
119     }
120 
121     /**
122      * @see wjhk.jupload2.gui.filepanel.FilePanel#remove(wjhk.jupload2.filedata.FileData)
123      */
124     public void remove(FileData fileData) {
125         this.logger.warn(this.getClass() + ".remove() is not implemented in tests cases");
126     }
127 
128     /**
129      * @see wjhk.jupload2.gui.filepanel.FilePanel#removeAll()
130      */
131     public void removeAll() {
132         throw new UnsupportedOperationException(this.getClass() + ".removeAll() is not implemented in tests cases");
133     }
134 
135     /**
136      * @see wjhk.jupload2.gui.filepanel.FilePanel#removeSelected()
137      */
138     public void removeSelected() {
139         throw new UnsupportedOperationException(this.getClass() + ".removeSelected() is not implemented in tests cases");
140     }
141 
142     /**
143      * @see wjhk.jupload2.gui.filepanel.FilePanel#setTransferHandler(javax.swing.TransferHandler)
144      */
145     public void setTransferHandler(TransferHandler newHandler) {
146         throw new UnsupportedOperationException(this.getClass()
147                 + ".setTransferHandler() is not implemented in tests cases");
148     }
149 
150     /**
151      * @see wjhk.jupload2.gui.filepanel.FilePanel#setGridBorderColor(java.awt.Color)
152      * @param color Color
153      */
154     public void setGridBorderColor(Color color) {
155         throw new UnsupportedOperationException(this.getClass()
156                 + ".setGridBorderColor() is not implemented in tests cases");
157     }
158 
159     /**
160      * @see wjhk.jupload2.gui.filepanel.FilePanel#setTableHeaderBackColor(java.awt.Color)
161      * @param color Color
162      */
163     public void setTableHeaderBackColor(Color color) {
164         throw new UnsupportedOperationException(this.getClass()
165                 + ".setTableHeaderBackColor() is not implemented in tests cases");
166     }
167 
168     /**
169      * @see wjhk.jupload2.gui.filepanel.FilePanel#setTableHeaderFont(java.awt.Font)
170      * @param font Font
171      */
172     public void setTableHeaderFont(Font font) {
173         throw new UnsupportedOperationException(this.getClass()
174                 + ".setTableHeaderFont() is not implemented in tests cases");
175     }
176 
177     /**
178      * @see wjhk.jupload2.gui.filepanel.FilePanel#setTableHeaderTextColor(java.awt.Color)
179      * @param color Color
180      */
181     public void setTableHeaderTextColor(Color color) {
182         throw new UnsupportedOperationException(this.getClass()
183                 + ".setTableHeaderTextColor() is not implemented in tests cases");
184     }
185 
186     public void setFileListViewMode(FileListViewMode fileListMode) {
187         // No action
188     }
189 
190     public void removeFileNotToUpload() {
191         // No action
192         removeFileNotToUpload_NbCalls += 1;
193     }
194 
195     public FileListViewMode getFileListMode() {
196         // TODO Auto-generated method stub
197         return null;
198     }
199 
200     public void reload() {
201         // TODO Auto-generated method stub
202 
203     }
204 
205     public void remove(FileData[] files) {
206         // TODO Auto-generated method stub
207 
208     }
209 
210     public void cleanHierarchy() {
211         // TODO Auto-generated method stub
212 
213     }
214 }