Statistics
| Revision:

root / trunk / libraries / libUI / src / org / gvsig / gui / beans / ProgressDialog.java @ 9054

History | View | Annotate | Download (4.66 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41

    
42
/* CVS MESSAGES:
43
 *
44
 * $Id: ProgressDialog.java 9054 2006-11-28 13:00:54Z jmvivo $
45
 * $Log$
46
 * Revision 1.6  2006-11-28 13:00:54  jmvivo
47
 * quitadas dependencias de andami
48
 *
49
 * Revision 1.5  2006/09/14 08:31:58  cesar
50
 * Replace PluginServices.getText by the new Messages bridge class from libUI
51
 *
52
 * Revision 1.4.2.1  2006/09/13 13:13:19  cesar
53
 * Replace PluginServices.getText by the new Messages bridge class from libUI
54
 *
55
 * Revision 1.4  2006/08/29 07:56:08  cesar
56
 * Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
57
 *
58
 * Revision 1.3  2006/06/15 15:47:25  jaume
59
 * *** empty log message ***
60
 *
61
 * Revision 1.2  2006/05/19 06:27:09  jaume
62
 * *** empty log message ***
63
 *
64
 * Revision 1.1  2006/05/17 17:20:11  jaume
65
 * *** empty log message ***
66
 *
67
 *
68
 */
69
package org.gvsig.gui.beans;
70

    
71
import javax.swing.JButton;
72
import javax.swing.JDialog;
73
import javax.swing.JLabel;
74
import javax.swing.JProgressBar;
75

    
76
//import com.iver.andami.messages.NotificationManager;
77
//import com.iver.andami.ui.mdiManager.SingletonWindow;
78
/** * 
79
 * 
80
 * Debe de ser independiente de andami.
81
 * Cuando se cumpla esta condicion quitaremos
82
 * el deprecated
83
 * 
84
 * 
85
 * @author jaume
86
 *
87
 * @deprecated  Falta terminar
88
 */
89
public class ProgressDialog extends JDialog {  
90

    
91
        private JProgressBar jProgressBar = null;
92
        private JButton btnCancel = null;
93
        private JLabel lblStatus = null;
94
        private JLabel lblTask = null;
95
        private String jobName;
96
        private CancellableComponent cc;
97

    
98
        /**
99
         * This is the default constructor
100
         */
101
        public ProgressDialog(CancellableComponent owner, String jobName, int stepAmount) {
102
                super();
103
                
104
                Exception e = new Exception();
105
                System.out.println("***** No deberia de usarse la clase " + ProgressDialog.class.getName());
106
                e.printStackTrace();
107
                
108
                
109
                this.jobName = jobName;
110
                getJProgressBar().setMinimum(0);
111
                getJProgressBar().setMaximum(stepAmount);
112
                cc = owner;
113
                initialize();
114
        }
115

    
116
        /**
117
         * This method initializes this
118
         * 
119
         * @return void
120
         */
121
        private void initialize() {
122
                lblTask = new JLabel();
123
                lblTask.setBounds(10, 12, 280, 20);
124
                lblTask.setFont(new java.awt.Font("MS Sans Serif", java.awt.Font.BOLD, 11));
125
                lblTask.setText(jobName);
126
                lblStatus = new JLabel();
127
                lblStatus.setBounds(10, 63, 280, 20);
128
                this.getContentPane().setLayout(null);
129
                this.setSize(308, 168);
130
                this.getContentPane().add(getJProgressBar(), null);
131
                this.getContentPane().add(getBtnCancel(), null);
132
                this.getContentPane().add(lblStatus, null);
133
                this.getContentPane().add(lblTask, null);
134
        }
135

    
136
        /**
137
         * This method initializes jProgressBar        
138
         *         
139
         * @return javax.swing.JProgressBar        
140
         */    
141
        private JProgressBar getJProgressBar() {
142
                if (jProgressBar == null) {
143
                        jProgressBar = new JProgressBar();
144
                        jProgressBar.setBounds(10, 38, 280, 20);
145
                }
146
                return jProgressBar;
147
        }
148

    
149
        /**
150
         * This method initializes btnCancel        
151
         *         
152
         * @return javax.swing.JButton        
153
         */    
154
        private JButton getBtnCancel() {
155
                if (btnCancel == null) {
156
                        btnCancel = new JButton();
157
                        btnCancel.setBounds(210, 96, 80, 20);
158
                        btnCancel.addActionListener(new java.awt.event.ActionListener() { 
159
                                public void actionPerformed(java.awt.event.ActionEvent e) {
160
                                        //NotificationManager.addInfo("The job was cancelled", null);
161
                                        if (cc!=null)
162
                                                cc.cancel();
163
                                }
164
                        });
165
                        btnCancel.setText(Messages.getText("cancel"));
166
                }
167
                return btnCancel;
168
        }
169
        
170
        public void setProgress(int step) {
171
                jProgressBar.setValue(step);
172
        }
173
        
174
        public void setStatusMessage(String message) {
175
                lblStatus.setText(message);
176
        }
177

    
178
}  //  @jve:decl-index=0:visual-constraint="10,10"