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  
26  package wjhk.jupload2.testhelpers;
27  
28  import java.awt.event.ActionListener;
29  import java.awt.event.MouseEvent;
30  import java.awt.event.MouseListener;
31  
32  import javax.swing.JButton;
33  import javax.swing.JComponent;
34  import javax.swing.JLabel;
35  import javax.swing.JPanel;
36  import javax.swing.JProgressBar;
37  import javax.swing.JScrollPane;
38  import javax.swing.TransferHandler;
39  
40  import org.apache.log4j.Logger;
41  
42  import wjhk.jupload2.gui.DnDListener;
43  import wjhk.jupload2.gui.JUploadPanel;
44  import wjhk.jupload2.gui.filepanel.FilePanel;
45  import wjhk.jupload2.upload.FileUploadManagerThread;
46  
47  /**
48   * @author etienne_sf
49   */
50  public class JUploadPanelTestHelper implements JUploadPanel, MouseListener {
51      /** Logger for this class */
52      protected final Logger logger = Logger.getLogger(getClass());
53  
54      /** */
55      public FilePanel filePanel = null;
56  
57      /** */
58      public FileUploadManagerThread fileUploadManagerThread = null;
59  
60      /** */
61      public JProgressBar preparationProgressBar = new JProgressBar();
62  
63      /** */
64      public JProgressBar uploadProgressBar = new JProgressBar();
65  
66      /** */
67      public JLabel statusLabel = new JLabel("JUpload applet (in JUnit tests)");
68  
69      /**
70       * @param filePanel
71       */
72      public JUploadPanelTestHelper(FilePanel filePanel) {
73          this.filePanel = filePanel;
74      }
75  
76      /**
77       * @see wjhk.jupload2.gui.JUploadPanel#clearLogWindow()
78       */
79      public void clearLogWindow() {
80          throw new UnsupportedOperationException(this.getClass() + ".clearLogWindow() is not implemented in tests cases");
81      }
82  
83      /**
84       * @see wjhk.jupload2.gui.JUploadPanel#copyLogWindow()
85       */
86      public void copyLogWindow() {
87          throw new UnsupportedOperationException(this.getClass() + ".copyLogWindow() is not implemented in tests cases");
88      }
89  
90      /**
91       * @see wjhk.jupload2.gui.JUploadPanel#doBrowse()
92       */
93      public void doBrowse() {
94          throw new UnsupportedOperationException(this.getClass() + ".doBrowse() is not implemented in tests cases");
95      }
96  
97      /**
98       * @see wjhk.jupload2.gui.JUploadPanel#doRemove()
99       */
100     public void doRemove() {
101         throw new UnsupportedOperationException(this.getClass() + ".doRemove() is not implemented in tests cases");
102     }
103 
104     /**
105      * @see wjhk.jupload2.gui.JUploadPanel#doRemoveAll()
106      */
107     public void doRemoveAll() {
108         throw new UnsupportedOperationException(this.getClass() + ".doRemoveAll() is not implemented in tests cases");
109     }
110 
111     /**
112      * @see wjhk.jupload2.gui.JUploadPanel#doStartUpload()
113      */
114     public void doStartUpload() {
115         throw new UnsupportedOperationException(this.getClass() + ".doStartUpload() is not implemented in tests cases");
116     }
117 
118     /**
119      * @see wjhk.jupload2.gui.JUploadPanel#doStopUpload()
120      */
121     public void doStopUpload() {
122         throw new UnsupportedOperationException(this.getClass() + ".doStopUpload() is not implemented in tests cases");
123     }
124 
125     /**
126      * @see wjhk.jupload2.gui.JUploadPanel#getActionListener()
127      */
128     public ActionListener getActionListener() {
129         throw new UnsupportedOperationException(this.getClass()
130                 + ".getActionListener() is not implemented in tests cases");
131     }
132 
133     /**
134      * @see wjhk.jupload2.gui.JUploadPanel#getBrowseButton()
135      */
136     public JButton getBrowseButton() {
137         throw new UnsupportedOperationException(this.getClass()
138                 + ".getBrowseButton() is not implemented in tests cases");
139     }
140 
141     /**
142      * @see wjhk.jupload2.gui.JUploadPanel#getDndListener()
143      */
144     public DnDListener getDndListener() {
145         throw new UnsupportedOperationException(this.getClass() + ".getDndListener() is not implemented in tests cases");
146     }
147 
148     /**
149      * @see wjhk.jupload2.gui.JUploadPanel#getFilePanel()
150      */
151     public FilePanel getFilePanel() {
152         return this.filePanel;
153     }
154 
155     /**
156      * @see wjhk.jupload2.gui.JUploadPanel#getFileUploadManagerThread()
157      */
158     public FileUploadManagerThread getFileUploadManagerThread() {
159         return this.fileUploadManagerThread;
160     }
161 
162     /**
163      * @see wjhk.jupload2.gui.JUploadPanel#getJComponent()
164      */
165     public JComponent getJComponent() {
166         throw new UnsupportedOperationException(this.getClass() + ".getJComponent() is not implemented in tests cases");
167     }
168 
169     /**
170      * @see wjhk.jupload2.gui.JUploadPanel#getJLogWindowPane()
171      */
172     public JScrollPane getJLogWindowPane() {
173         throw new UnsupportedOperationException(this.getClass()
174                 + ".getJLogWindowPane() is not implemented in tests cases");
175     }
176 
177     /**
178      * @see wjhk.jupload2.gui.JUploadPanel#getMouseListener()
179      */
180     public MouseListener getMouseListener() {
181         return this;
182     }
183 
184     /**
185      * @see wjhk.jupload2.gui.JUploadPanel#getPreparationProgressBar()
186      */
187     public JProgressBar getPreparationProgressBar() {
188         return this.preparationProgressBar;
189     }
190 
191     /**
192      * @see wjhk.jupload2.gui.JUploadPanel#getRemoveAllButton()
193      */
194     public JButton getRemoveAllButton() {
195         throw new UnsupportedOperationException(this.getClass()
196                 + ".getRemoveAllButton() is not implemented in tests cases");
197     }
198 
199     /**
200      * @see wjhk.jupload2.gui.JUploadPanel#getRemoveButton()
201      */
202     public JButton getRemoveButton() {
203         throw new UnsupportedOperationException(this.getClass()
204                 + ".getRemoveButton() is not implemented in tests cases");
205     }
206 
207     /**
208      * @see wjhk.jupload2.gui.JUploadPanel#getStatusLabel()
209      */
210     public JLabel getStatusLabel() {
211         return this.statusLabel;
212     }
213 
214     /**
215      * @see wjhk.jupload2.gui.JUploadPanel#getStopButton()
216      */
217     public JButton getStopButton() {
218         throw new UnsupportedOperationException(this.getClass() + ".getStopButton() is not implemented in tests cases");
219     }
220 
221     /**
222      * @see wjhk.jupload2.gui.JUploadPanel#getTransferHandler()
223      */
224     public TransferHandler getTransferHandler() {
225         JPanel jp = new JPanel();
226         return jp.getTransferHandler();
227     }
228 
229     /**
230      * @see wjhk.jupload2.gui.JUploadPanel#getUploadButton()
231      */
232     public JButton getUploadButton() {
233         throw new UnsupportedOperationException(this.getClass()
234                 + ".getUploadButton() is not implemented in tests cases");
235     }
236 
237     /**
238      * @see wjhk.jupload2.gui.JUploadPanel#getUploadProgressBar()
239      */
240     public JProgressBar getUploadProgressBar() {
241         return this.uploadProgressBar;
242     }
243 
244     /**
245      * @see wjhk.jupload2.gui.JUploadPanel#maybeOpenPopupMenu(java.awt.event.MouseEvent)
246      */
247     public boolean maybeOpenPopupMenu(MouseEvent mouseEvent) {
248         throw new UnsupportedOperationException(this.getClass()
249                 + ".maybeOpenPopupMenu() is not implemented in tests cases");
250     }
251 
252     /**
253      * @see wjhk.jupload2.gui.JUploadPanel#setFilePanel(wjhk.jupload2.gui.filepanel.FilePanel)
254      */
255     public void setFilePanel(FilePanel filePanel) {
256         throw new UnsupportedOperationException(this.getClass() + ".setFilePanel() is not implemented in tests cases");
257     }
258 
259     /**
260      * @see wjhk.jupload2.gui.JUploadPanel#showOrHideLogWindow()
261      */
262     public void showOrHideLogWindow() {
263         this.logger.warn(this.getClass() + ".showOrHideLogWindow() is not implemented in tests cases");
264     }
265 
266     /**
267      * @see wjhk.jupload2.gui.JUploadPanel#updateButtonState()
268      */
269     public void updateButtonState() {
270         this.logger.warn(this.getClass() + ".updateButtonState() is not implemented in tests cases");
271     }
272 
273     public void mouseClicked(MouseEvent e) {
274         // TODO Auto-generated method stub
275 
276     }
277 
278     public void mousePressed(MouseEvent e) {
279         // TODO Auto-generated method stub
280 
281     }
282 
283     public void mouseReleased(MouseEvent e) {
284         // TODO Auto-generated method stub
285 
286     }
287 
288     public void mouseEntered(MouseEvent e) {
289         // TODO Auto-generated method stub
290 
291     }
292 
293     public void mouseExited(MouseEvent e) {
294         // TODO Auto-generated method stub
295 
296     }
297 
298 }