svn-gvsig-desktop / trunk / libraries / libUI / src / org / gvsig / gui / beans / ProgressDialog.java @ 5931
History | View | Annotate | Download (3.91 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 5869 2006-06-15 15:47:25Z jaume $
|
45 |
* $Log$
|
46 |
* Revision 1.3 2006-06-15 15:47:25 jaume
|
47 |
* *** empty log message ***
|
48 |
*
|
49 |
* Revision 1.2 2006/05/19 06:27:09 jaume
|
50 |
* *** empty log message ***
|
51 |
*
|
52 |
* Revision 1.1 2006/05/17 17:20:11 jaume
|
53 |
* *** empty log message ***
|
54 |
*
|
55 |
*
|
56 |
*/
|
57 |
package org.gvsig.gui.beans; |
58 |
|
59 |
import javax.swing.JButton; |
60 |
import javax.swing.JDialog; |
61 |
import javax.swing.JLabel; |
62 |
import javax.swing.JProgressBar; |
63 |
|
64 |
import com.iver.andami.PluginServices; |
65 |
import com.iver.andami.messages.NotificationManager; |
66 |
import com.iver.andami.ui.mdiManager.SingletonView; |
67 |
/**
|
68 |
* @author jaume
|
69 |
*
|
70 |
*/
|
71 |
public class ProgressDialog extends JDialog { |
72 |
|
73 |
private JProgressBar jProgressBar = null; |
74 |
private JButton btnCancel = null; |
75 |
private JLabel lblStatus = null; |
76 |
private JLabel lblTask = null; |
77 |
private String jobName; |
78 |
private CancellableComponent cc;
|
79 |
|
80 |
/**
|
81 |
* This is the default constructor
|
82 |
*/
|
83 |
public ProgressDialog(CancellableComponent owner, String jobName, int stepAmount) { |
84 |
super();
|
85 |
this.jobName = jobName;
|
86 |
getJProgressBar().setMinimum(0);
|
87 |
getJProgressBar().setMaximum(stepAmount); |
88 |
cc = owner; |
89 |
initialize(); |
90 |
} |
91 |
|
92 |
/**
|
93 |
* This method initializes this
|
94 |
*
|
95 |
* @return void
|
96 |
*/
|
97 |
private void initialize() { |
98 |
lblTask = new JLabel(); |
99 |
lblTask.setBounds(10, 12, 280, 20); |
100 |
lblTask.setFont(new java.awt.Font("MS Sans Serif", java.awt.Font.BOLD, 11)); |
101 |
lblTask.setText(jobName); |
102 |
lblStatus = new JLabel(); |
103 |
lblStatus.setBounds(10, 63, 280, 20); |
104 |
this.getContentPane().setLayout(null); |
105 |
this.setSize(308, 168); |
106 |
this.getContentPane().add(getJProgressBar(), null); |
107 |
this.getContentPane().add(getBtnCancel(), null); |
108 |
this.getContentPane().add(lblStatus, null); |
109 |
this.getContentPane().add(lblTask, null); |
110 |
} |
111 |
|
112 |
/**
|
113 |
* This method initializes jProgressBar
|
114 |
*
|
115 |
* @return javax.swing.JProgressBar
|
116 |
*/
|
117 |
private JProgressBar getJProgressBar() { |
118 |
if (jProgressBar == null) { |
119 |
jProgressBar = new JProgressBar(); |
120 |
jProgressBar.setBounds(10, 38, 280, 20); |
121 |
} |
122 |
return jProgressBar;
|
123 |
} |
124 |
|
125 |
/**
|
126 |
* This method initializes btnCancel
|
127 |
*
|
128 |
* @return javax.swing.JButton
|
129 |
*/
|
130 |
private JButton getBtnCancel() { |
131 |
if (btnCancel == null) { |
132 |
btnCancel = new JButton(); |
133 |
btnCancel.setBounds(210, 96, 80, 20); |
134 |
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
135 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
136 |
NotificationManager.addInfo("The job was cancelled", null); |
137 |
if (cc!=null) |
138 |
cc.cancel(); |
139 |
} |
140 |
}); |
141 |
btnCancel.setText(PluginServices.getText(this, "cancel")); |
142 |
} |
143 |
return btnCancel;
|
144 |
} |
145 |
|
146 |
public void setProgress(int step) { |
147 |
jProgressBar.setValue(step); |
148 |
} |
149 |
|
150 |
public void setStatusMessage(String message) { |
151 |
lblStatus.setText(message); |
152 |
} |
153 |
|
154 |
} // @jve:decl-index=0:visual-constraint="10,10"
|