View Javadoc
1   //
2   // $Id: DialogPicturePanel.java 95 2007-05-02 03:27:05 +0000 (mer., 02 mai 2007)
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: 2006-07-11
10  // Creator: etienne_sf
11  // Last modified: $Date: 2009-02-16 12:42:50 +0100 (lun., 16 févr. 2009) $
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.image;
24  
25  import java.awt.event.MouseEvent;
26  
27  import wjhk.jupload2.filedata.PictureFileData;
28  import wjhk.jupload2.policies.UploadPolicy;
29  
30  /**
31   * The picture for the PictureDialog. The difference with the PicturePanel, is
32   * that a click on it closes the Dialog.
33   * 
34   * @author etienne_sf
35   */
36  public class DialogPicturePanel extends PicturePanel {
37  
38      /** A generated serialVersionUID, to avoid warning during compilation */
39      private static final long serialVersionUID = 1333603128496671158L;
40  
41      /**
42       * The JDialog containing this panel.
43       */
44      PictureDialog pictureDialog;
45  
46      /**
47       * @param pictureDialog
48       * @param uploadPolicy
49       * @param pictureFileData
50       * 
51       */
52      public DialogPicturePanel(PictureDialog pictureDialog,
53              UploadPolicy uploadPolicy, PictureFileData pictureFileData) {
54          super(false, uploadPolicy);
55  
56          this.pictureDialog = pictureDialog;
57          // pictureDialog.getContentPane().setCursor(new
58          // Cursor(Cursor.WAIT_CURSOR));
59          setPictureFile(pictureFileData, null, null);
60          // pictureDialog.getContentPane().setCursor(null);
61      }
62  
63      /**
64       * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
65       */
66      @Override
67      public void mouseClicked(MouseEvent arg0) {
68          // Let's close the current DialogBox, if it has not already be done.
69          if (this.pictureDialog != null) {
70              this.uploadPolicy.displayDebug(
71                      "[DialogPicturePanel] Before pictureDialog.dispose()", 50);
72              this.pictureDialog.dispose();
73              this.pictureDialog = null;
74          }
75      }
76  }