root / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / ProgressDialog.java @ 13136
History | View | Annotate | Download (4.75 KB)
1 | 13136 | evercher | /* 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$
|
||
45 | * $Log$
|
||
46 | * Revision 1.1 2007-08-20 08:34:45 evercher
|
||
47 | * He fusionado LibUI con LibUIComponents
|
||
48 | *
|
||
49 | * Revision 1.6 2006/11/28 13:00:54 jmvivo
|
||
50 | * quitadas dependencias de andami
|
||
51 | *
|
||
52 | * Revision 1.5 2006/09/14 08:31:58 cesar
|
||
53 | * Replace PluginServices.getText by the new Messages bridge class from libUI
|
||
54 | *
|
||
55 | * Revision 1.4.2.1 2006/09/13 13:13:19 cesar
|
||
56 | * Replace PluginServices.getText by the new Messages bridge class from libUI
|
||
57 | *
|
||
58 | * Revision 1.4 2006/08/29 07:56:08 cesar
|
||
59 | * Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
|
||
60 | *
|
||
61 | * Revision 1.3 2006/06/15 15:47:25 jaume
|
||
62 | * *** empty log message ***
|
||
63 | *
|
||
64 | * Revision 1.2 2006/05/19 06:27:09 jaume
|
||
65 | * *** empty log message ***
|
||
66 | *
|
||
67 | * Revision 1.1 2006/05/17 17:20:11 jaume
|
||
68 | * *** empty log message ***
|
||
69 | *
|
||
70 | *
|
||
71 | */
|
||
72 | package org.gvsig.gui.beans; |
||
73 | |||
74 | import javax.swing.JButton; |
||
75 | import javax.swing.JDialog; |
||
76 | import javax.swing.JLabel; |
||
77 | import javax.swing.JProgressBar; |
||
78 | |||
79 | //import com.iver.andami.messages.NotificationManager;
|
||
80 | //import com.iver.andami.ui.mdiManager.SingletonWindow;
|
||
81 | /** *
|
||
82 | *
|
||
83 | * Debe de ser independiente de andami.
|
||
84 | * Cuando se cumpla esta condicion quitaremos
|
||
85 | * el deprecated
|
||
86 | *
|
||
87 | *
|
||
88 | * @author jaume
|
||
89 | *
|
||
90 | * @deprecated Falta terminar
|
||
91 | */
|
||
92 | public class ProgressDialog extends JDialog { |
||
93 | |||
94 | private JProgressBar jProgressBar = null; |
||
95 | private JButton btnCancel = null; |
||
96 | private JLabel lblStatus = null; |
||
97 | private JLabel lblTask = null; |
||
98 | private String jobName; |
||
99 | private CancellableComponent cc;
|
||
100 | |||
101 | /**
|
||
102 | * This is the default constructor
|
||
103 | */
|
||
104 | public ProgressDialog(CancellableComponent owner, String jobName, int stepAmount) { |
||
105 | super();
|
||
106 | |||
107 | Exception e = new Exception(); |
||
108 | System.out.println("***** No deberia de usarse la clase " + ProgressDialog.class.getName()); |
||
109 | e.printStackTrace(); |
||
110 | |||
111 | |||
112 | this.jobName = jobName;
|
||
113 | getJProgressBar().setMinimum(0);
|
||
114 | getJProgressBar().setMaximum(stepAmount); |
||
115 | cc = owner; |
||
116 | initialize(); |
||
117 | } |
||
118 | |||
119 | /**
|
||
120 | * This method initializes this
|
||
121 | *
|
||
122 | * @return void
|
||
123 | */
|
||
124 | private void initialize() { |
||
125 | lblTask = new JLabel(); |
||
126 | lblTask.setBounds(10, 12, 280, 20); |
||
127 | lblTask.setFont(new java.awt.Font("MS Sans Serif", java.awt.Font.BOLD, 11)); |
||
128 | lblTask.setText(jobName); |
||
129 | lblStatus = new JLabel(); |
||
130 | lblStatus.setBounds(10, 63, 280, 20); |
||
131 | this.getContentPane().setLayout(null); |
||
132 | this.setSize(308, 168); |
||
133 | this.getContentPane().add(getJProgressBar(), null); |
||
134 | this.getContentPane().add(getBtnCancel(), null); |
||
135 | this.getContentPane().add(lblStatus, null); |
||
136 | this.getContentPane().add(lblTask, null); |
||
137 | } |
||
138 | |||
139 | /**
|
||
140 | * This method initializes jProgressBar
|
||
141 | *
|
||
142 | * @return javax.swing.JProgressBar
|
||
143 | */
|
||
144 | private JProgressBar getJProgressBar() { |
||
145 | if (jProgressBar == null) { |
||
146 | jProgressBar = new JProgressBar(); |
||
147 | jProgressBar.setBounds(10, 38, 280, 20); |
||
148 | } |
||
149 | return jProgressBar;
|
||
150 | } |
||
151 | |||
152 | /**
|
||
153 | * This method initializes btnCancel
|
||
154 | *
|
||
155 | * @return javax.swing.JButton
|
||
156 | */
|
||
157 | private JButton getBtnCancel() { |
||
158 | if (btnCancel == null) { |
||
159 | btnCancel = new JButton(); |
||
160 | btnCancel.setBounds(210, 96, 80, 20); |
||
161 | btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
||
162 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
163 | //NotificationManager.addInfo("The job was cancelled", null);
|
||
164 | if (cc!=null) |
||
165 | cc.cancel(); |
||
166 | } |
||
167 | }); |
||
168 | btnCancel.setText(Messages.getText("cancel"));
|
||
169 | } |
||
170 | return btnCancel;
|
||
171 | } |
||
172 | |||
173 | public void setProgress(int step) { |
||
174 | jProgressBar.setValue(step); |
||
175 | } |
||
176 | |||
177 | public void setStatusMessage(String message) { |
||
178 | lblStatus.setText(message); |
||
179 | } |
||
180 | |||
181 | } // @jve:decl-index=0:visual-constraint="10,10" |