Revision 1268 trunk/frameworks/_fwAndami/src/com/iver/andami/ui/mdiFrame/NewStatusBar.java
NewStatusBar.java | ||
---|---|---|
66 | 66 |
/** |
67 | 67 |
*/ |
68 | 68 |
public class NewStatusBar extends JPanel { |
69 |
private static Logger logger = Logger.getLogger(NewStatusBar.class.getName()); |
|
70 |
private static final int INFO = 0; |
|
71 |
private static final int WARNING = 1; |
|
72 |
private static final int ERROR = 2; |
|
73 |
private JLabel lblIcon = null; |
|
74 |
private JLabel lblTexto = null; |
|
75 |
private boolean contenidoTemporal; |
|
76 |
private String textoAnterior; |
|
77 |
private int estadoAnterior; |
|
78 |
private ImageIcon infoIcon; |
|
79 |
private ImageIcon warningIcon; |
|
80 |
private ImageIcon errorIcon; |
|
81 |
private int estado; |
|
82 |
private JProgressBar progressBar = null; |
|
83 |
private HashMap idLabel = new HashMap(); |
|
84 |
private int[] widthlabels=null; |
|
85 |
/** |
|
86 |
* This is the default constructor |
|
87 |
*/ |
|
88 |
public NewStatusBar() { |
|
89 |
super(); |
|
90 |
initialize(); |
|
91 |
infoIcon = new ImageIcon(NewStatusBar.class.getClassLoader() |
|
92 |
.getResource("images/info.gif")); |
|
93 |
warningIcon = new ImageIcon(NewStatusBar.class.getClassLoader() |
|
94 |
.getResource("images/warning.gif")); |
|
95 |
errorIcon = new ImageIcon(NewStatusBar.class.getClassLoader() |
|
96 |
.getResource("images/error.gif")); |
|
97 |
} |
|
69 |
private static Logger logger = Logger.getLogger(NewStatusBar.class.getName()); |
|
70 |
private static final int INFO = 0; |
|
71 |
private static final int WARNING = 1; |
|
72 |
private static final int ERROR = 2; |
|
73 |
private JLabel lblIcon = null; |
|
74 |
private JLabel lblTexto = null; |
|
75 |
private boolean contenidoTemporal; |
|
76 |
private String textoAnterior; |
|
77 |
private int estadoAnterior; |
|
78 |
private ImageIcon infoIcon; |
|
79 |
private ImageIcon warningIcon; |
|
80 |
private ImageIcon errorIcon; |
|
81 |
private int estado; |
|
82 |
private JProgressBar progressBar = null; |
|
83 |
private HashMap idLabel = new HashMap(); |
|
84 |
private int[] widthlabels = null; |
|
98 | 85 |
|
99 |
/** |
|
100 |
* This method initializes this |
|
101 |
*/ |
|
102 |
private void initialize() { |
|
103 |
lblIcon = new JLabel(); |
|
104 |
lblTexto = new JLabel(); |
|
86 |
/** |
|
87 |
* This is the default constructor |
|
88 |
*/ |
|
89 |
public NewStatusBar() { |
|
90 |
super(); |
|
91 |
initialize(); |
|
92 |
infoIcon = new ImageIcon(NewStatusBar.class.getClassLoader() |
|
93 |
.getResource("images/info.gif")); |
|
94 |
warningIcon = new ImageIcon(NewStatusBar.class.getClassLoader() |
|
95 |
.getResource("images/warning.gif")); |
|
96 |
errorIcon = new ImageIcon(NewStatusBar.class.getClassLoader() |
|
97 |
.getResource("images/error.gif")); |
|
98 |
} |
|
105 | 99 |
|
106 |
FlowLayout flowLayout2 = new FlowLayout(); |
|
107 |
this.setLayout(flowLayout2); |
|
108 |
flowLayout2.setHgap(1); |
|
109 |
flowLayout2.setVgap(0); |
|
110 |
flowLayout2.setAlignment(java.awt.FlowLayout.LEFT); |
|
111 |
lblIcon.setText(""); |
|
112 |
lblTexto.setText(Messages.getString("StatusBar.Aplicacion_iniciada")); |
|
113 |
this.add(lblIcon, null); |
|
114 |
this.add(getProgressBar(), null); |
|
115 |
this.add(lblTexto, null); |
|
116 |
} |
|
100 |
/** |
|
101 |
* This method initializes this |
|
102 |
*/ |
|
103 |
private void initialize() { |
|
104 |
lblIcon = new JLabel(); |
|
105 |
lblTexto = new JLabel(); |
|
117 | 106 |
|
118 |
/** |
|
119 |
* Obtiene el texto de la barra de estado |
|
120 |
* |
|
121 |
* @return texto |
|
122 |
*/ |
|
123 |
public String getStatusText() { |
|
124 |
return lblTexto.getText(); |
|
125 |
} |
|
107 |
FlowLayout flowLayout2 = new FlowLayout(); |
|
108 |
this.setLayout(flowLayout2); |
|
109 |
flowLayout2.setHgap(1); |
|
110 |
flowLayout2.setVgap(0); |
|
111 |
flowLayout2.setAlignment(java.awt.FlowLayout.LEFT); |
|
112 |
lblIcon.setText(""); |
|
113 |
lblTexto.setText(Messages.getString("StatusBar.Aplicacion_iniciada")); |
|
114 |
this.add(lblIcon, null); |
|
115 |
this.add(getProgressBar(), null); |
|
116 |
this.add(lblTexto, null); |
|
117 |
} |
|
126 | 118 |
|
127 |
/**
|
|
128 |
* Restaura el contenido permanente de la barra de estado
|
|
129 |
*/
|
|
130 |
public void restaurarTexto() {
|
|
131 |
contenidoTemporal = false;
|
|
132 |
if (estadoAnterior == -1) {
|
|
133 |
return;
|
|
134 |
}
|
|
119 |
/**
|
|
120 |
* Obtiene el texto de la barra de estado
|
|
121 |
*
|
|
122 |
* @return texto
|
|
123 |
*/
|
|
124 |
public String getStatusText() {
|
|
125 |
return lblTexto.getText();
|
|
126 |
}
|
|
135 | 127 |
|
136 |
switch (estadoAnterior) { |
|
137 |
case INFO: |
|
138 |
setInfoText(textoAnterior); |
|
128 |
/** |
|
129 |
* Restaura el contenido permanente de la barra de estado |
|
130 |
*/ |
|
131 |
public void restaurarTexto() { |
|
132 |
contenidoTemporal = false; |
|
139 | 133 |
|
140 |
break; |
|
134 |
if (estadoAnterior == -1) { |
|
135 |
return; |
|
136 |
} |
|
141 | 137 |
|
142 |
case WARNING: |
|
143 |
setWarningText(textoAnterior); |
|
138 |
switch (estadoAnterior) { |
|
139 |
case INFO: |
|
140 |
setInfoText(textoAnterior); |
|
144 | 141 |
|
145 |
break;
|
|
142 |
break;
|
|
146 | 143 |
|
147 |
case ERROR:
|
|
148 |
setErrorText(textoAnterior);
|
|
144 |
case WARNING:
|
|
145 |
setWarningText(textoAnterior);
|
|
149 | 146 |
|
150 |
break; |
|
151 |
} |
|
147 |
break; |
|
152 | 148 |
|
153 |
estadoAnterior = -1; |
|
154 |
textoAnterior = null; |
|
155 |
} |
|
149 |
case ERROR: |
|
150 |
setErrorText(textoAnterior); |
|
156 | 151 |
|
157 |
/** |
|
158 |
* Establece el texto de la barra de estado de forma temporal. Se almacena |
|
159 |
* el texto que hab?a en la barra de estado. |
|
160 |
* |
|
161 |
* @param texto texto |
|
162 |
*/ |
|
163 |
public void setInfoTextTemporal(String texto) { |
|
164 |
contenidoTemporal = true; |
|
152 |
break; |
|
153 |
} |
|
165 | 154 |
|
166 |
estadoAnterior = this.estado;
|
|
167 |
this.estado = INFO;
|
|
168 |
lblIcon.setIcon(infoIcon);
|
|
155 |
estadoAnterior = -1;
|
|
156 |
textoAnterior = null;
|
|
157 |
}
|
|
169 | 158 |
|
170 |
textoAnterior = getStatusText(); |
|
171 |
lblTexto.setText(texto); |
|
172 |
} |
|
159 |
/** |
|
160 |
* Establece el texto de la barra de estado de forma temporal. Se almacena |
|
161 |
* el texto que hab?a en la barra de estado. |
|
162 |
* |
|
163 |
* @param texto texto |
|
164 |
*/ |
|
165 |
public void setInfoTextTemporal(String texto) { |
|
166 |
contenidoTemporal = true; |
|
173 | 167 |
|
174 |
/** |
|
175 |
* Establece el texto de la barra de estado de forma temporal. Se almacena |
|
176 |
* el texto que hab?a en la barra de estado. |
|
177 |
* |
|
178 |
* @param texto texto |
|
179 |
*/ |
|
180 |
public void setWarningTextTemporal(String texto) { |
|
181 |
contenidoTemporal = true; |
|
168 |
estadoAnterior = this.estado; |
|
169 |
this.estado = INFO; |
|
170 |
lblIcon.setIcon(infoIcon); |
|
182 | 171 |
|
183 |
estadoAnterior = this.estado;
|
|
184 |
this.estado = WARNING;
|
|
185 |
lblIcon.setIcon(warningIcon);
|
|
172 |
textoAnterior = getStatusText();
|
|
173 |
lblTexto.setText(texto);
|
|
174 |
}
|
|
186 | 175 |
|
187 |
textoAnterior = getStatusText(); |
|
188 |
lblTexto.setText(texto); |
|
189 |
} |
|
176 |
/** |
|
177 |
* Establece el texto de la barra de estado de forma temporal. Se almacena |
|
178 |
* el texto que hab?a en la barra de estado. |
|
179 |
* |
|
180 |
* @param texto texto |
|
181 |
*/ |
|
182 |
public void setWarningTextTemporal(String texto) { |
|
183 |
contenidoTemporal = true; |
|
190 | 184 |
|
191 |
/** |
|
192 |
* Establece el texto de la barra de estado de forma temporal. Se almacena |
|
193 |
* el texto que hab?a en la barra de estado. |
|
194 |
* |
|
195 |
* @param texto texto |
|
196 |
*/ |
|
197 |
public void setErrorTextTemporal(String texto) { |
|
198 |
contenidoTemporal = true; |
|
185 |
estadoAnterior = this.estado; |
|
186 |
this.estado = WARNING; |
|
187 |
lblIcon.setIcon(warningIcon); |
|
199 | 188 |
|
200 |
estadoAnterior = this.estado;
|
|
201 |
this.estado = ERROR;
|
|
202 |
lblIcon.setIcon(errorIcon);
|
|
189 |
textoAnterior = getStatusText();
|
|
190 |
lblTexto.setText(texto);
|
|
191 |
}
|
|
203 | 192 |
|
204 |
textoAnterior = getStatusText(); |
|
205 |
lblTexto.setText(texto); |
|
206 |
} |
|
193 |
/** |
|
194 |
* Establece el texto de la barra de estado de forma temporal. Se almacena |
|
195 |
* el texto que hab?a en la barra de estado. |
|
196 |
* |
|
197 |
* @param texto texto |
|
198 |
*/ |
|
199 |
public void setErrorTextTemporal(String texto) { |
|
200 |
contenidoTemporal = true; |
|
207 | 201 |
|
208 |
/** |
|
209 |
* Establece el texto de la barar de manera permanente. Si se est? |
|
210 |
* mostrando texto de forma temporal no se actualiza la interfaz |
|
211 |
* |
|
212 |
* @param texto Texto |
|
213 |
*/ |
|
214 |
public void setInfoText(String texto) { |
|
215 |
if (contenidoTemporal) { |
|
216 |
textoAnterior = texto; |
|
217 |
estadoAnterior = INFO; |
|
218 |
} else { |
|
219 |
lblTexto.setText(texto); |
|
220 |
lblIcon.setIcon(infoIcon); |
|
221 |
estado = INFO; |
|
222 |
} |
|
223 |
} |
|
202 |
estadoAnterior = this.estado; |
|
203 |
this.estado = ERROR; |
|
204 |
lblIcon.setIcon(errorIcon); |
|
224 | 205 |
|
225 |
/** |
|
226 |
* Establece el texto de la barar de manera permanente. Si se est? |
|
227 |
* mostrando texto de forma temporal no se actualiza la interfaz |
|
228 |
* |
|
229 |
* @param texto Texto |
|
230 |
*/ |
|
231 |
public void setWarningText(String texto) { |
|
232 |
if (contenidoTemporal) { |
|
233 |
textoAnterior = texto; |
|
234 |
estadoAnterior = WARNING; |
|
235 |
} else { |
|
236 |
lblTexto.setText(texto); |
|
237 |
lblIcon.setIcon(warningIcon); |
|
238 |
estado = WARNING; |
|
239 |
} |
|
240 |
} |
|
206 |
textoAnterior = getStatusText(); |
|
207 |
lblTexto.setText(texto); |
|
208 |
} |
|
241 | 209 |
|
242 |
/**
|
|
243 |
* Establece el texto de la barar de manera permanente. Si se est?
|
|
244 |
* mostrando texto de forma temporal no se actualiza la interfaz
|
|
245 |
*
|
|
246 |
* @param texto Texto
|
|
247 |
*/
|
|
248 |
public void setErrorText(String texto) {
|
|
249 |
if (contenidoTemporal) {
|
|
250 |
textoAnterior = texto;
|
|
251 |
estadoAnterior = ERROR;
|
|
252 |
} else {
|
|
253 |
lblTexto.setText(texto);
|
|
254 |
lblIcon.setIcon(errorIcon);
|
|
255 |
estado = ERROR;
|
|
256 |
}
|
|
257 |
}
|
|
210 |
/**
|
|
211 |
* Establece el texto de la barar de manera permanente. Si se est?
|
|
212 |
* mostrando texto de forma temporal no se actualiza la interfaz
|
|
213 |
*
|
|
214 |
* @param texto Texto
|
|
215 |
*/
|
|
216 |
public void setInfoText(String texto) {
|
|
217 |
if (contenidoTemporal) {
|
|
218 |
textoAnterior = texto;
|
|
219 |
estadoAnterior = INFO;
|
|
220 |
} else {
|
|
221 |
lblTexto.setText(texto);
|
|
222 |
lblIcon.setIcon(infoIcon);
|
|
223 |
estado = INFO;
|
|
224 |
}
|
|
225 |
}
|
|
258 | 226 |
|
259 |
/** |
|
260 |
* Establece el porcentaje en la barra de progreso. Si es 100 se oculta la |
|
261 |
* barra |
|
262 |
* |
|
263 |
* @param p DOCUMENT ME! |
|
264 |
*/ |
|
265 |
public void setProgress(int p) { |
|
266 |
if (p < 100) { |
|
267 |
getProgressBar().setValue(p); |
|
268 |
getProgressBar().setVisible(true); |
|
269 |
} else { |
|
270 |
getProgressBar().setVisible(false); |
|
271 |
} |
|
227 |
/** |
|
228 |
* Establece el texto de la barar de manera permanente. Si se est? |
|
229 |
* mostrando texto de forma temporal no se actualiza la interfaz |
|
230 |
* |
|
231 |
* @param texto Texto |
|
232 |
*/ |
|
233 |
public void setWarningText(String texto) { |
|
234 |
if (contenidoTemporal) { |
|
235 |
textoAnterior = texto; |
|
236 |
estadoAnterior = WARNING; |
|
237 |
} else { |
|
238 |
lblTexto.setText(texto); |
|
239 |
lblIcon.setIcon(warningIcon); |
|
240 |
estado = WARNING; |
|
241 |
} |
|
242 |
} |
|
272 | 243 |
|
273 |
getProgressBar().repaint(); |
|
274 |
} |
|
244 |
/** |
|
245 |
* Establece el texto de la barar de manera permanente. Si se est? |
|
246 |
* mostrando texto de forma temporal no se actualiza la interfaz |
|
247 |
* |
|
248 |
* @param texto Texto |
|
249 |
*/ |
|
250 |
public void setErrorText(String texto) { |
|
251 |
if (contenidoTemporal) { |
|
252 |
textoAnterior = texto; |
|
253 |
estadoAnterior = ERROR; |
|
254 |
} else { |
|
255 |
lblTexto.setText(texto); |
|
256 |
lblIcon.setIcon(errorIcon); |
|
257 |
estado = ERROR; |
|
258 |
} |
|
259 |
} |
|
275 | 260 |
|
276 |
/** |
|
277 |
* DOCUMENT ME! |
|
278 |
* |
|
279 |
* @param labels DOCUMENT ME! |
|
280 |
*/ |
|
281 |
public void setLabelSet(Label[] labels) { |
|
282 |
removeAllLabels(); |
|
283 |
idLabel.clear(); |
|
261 |
/** |
|
262 |
* Establece el porcentaje en la barra de progreso. Si es 100 se oculta la |
|
263 |
* barra |
|
264 |
* |
|
265 |
* @param p DOCUMENT ME! |
|
266 |
*/ |
|
267 |
public void setProgress(int p) { |
|
268 |
if (p < 100) { |
|
269 |
getProgressBar().setValue(p); |
|
270 |
getProgressBar().setVisible(true); |
|
271 |
} else { |
|
272 |
getProgressBar().setVisible(false); |
|
273 |
} |
|
284 | 274 |
|
285 |
for (int i = 0; i < labels.length; i++) { |
|
286 |
JLabel lbl = new JLabel(); |
|
287 |
lbl.setPreferredSize(new Dimension(labels[i].getSize(), |
|
288 |
this.getHeight())); |
|
289 |
lbl.setSize(new Dimension(labels[i].getSize(), |
|
290 |
this.getHeight())); |
|
291 |
lbl.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); |
|
292 |
this.add(lbl); |
|
293 |
/* if (i != labels.length - 1){ |
|
294 |
this.add(new JSeparator(JSeparator.VERTICAL)); |
|
295 |
} |
|
296 |
*/ |
|
297 |
idLabel.put(labels[i].getId(), lbl); |
|
298 |
} |
|
299 |
JLabel[] configlabels=(JLabel[])idLabel.values().toArray(new JLabel[0]); |
|
300 |
widthlabels=new int[configlabels.length]; |
|
301 |
for (int i=0;i<labels.length;i++){ |
|
302 |
widthlabels[i]=configlabels[i].getWidth(); |
|
303 |
} |
|
304 |
|
|
305 |
this.repaint(); |
|
306 |
} |
|
307 |
public void ajustar(){ |
|
308 |
if (widthlabels==null)return; |
|
309 |
int ws=this.getWidth(); |
|
310 |
|
|
311 |
JLabel[] labels=(JLabel[])idLabel.values().toArray(new JLabel[0]); |
|
312 |
double total=1; |
|
313 |
for (int i=0;i<widthlabels.length;i++){ |
|
314 |
if (labels[i].getText().compareTo("")!=0){ |
|
315 |
total+=widthlabels[i]; |
|
316 |
} |
|
317 |
} |
|
318 |
double p=(ws-lblTexto.getWidth()-20)/total; |
|
319 |
|
|
320 |
for (int i=0;i<labels.length;i++){ |
|
321 |
//if (labels[i] instanceof JLabel){ |
|
322 |
JLabel label=(JLabel)labels[i]; |
|
323 |
if (label.getText().compareTo("")!=0){ |
|
324 |
label.setVisible(true); |
|
325 |
label.setPreferredSize(new Dimension((int)(widthlabels[i]),this.getHeight())); |
|
326 |
}else{ |
|
327 |
label.setVisible(false); |
|
328 |
//label.setPreferredSize(new Dimension(0,this.getHeight())); |
|
329 |
} |
|
330 |
//} |
|
331 |
} |
|
332 |
} |
|
333 |
public void borrar(){ |
|
334 |
JLabel[] labels=(JLabel[])idLabel.values().toArray(new JLabel[0]); |
|
335 |
/*int total=1; |
|
336 |
for (int i=0;i<labels.length;i++){ |
|
337 |
total+=labels[i].getWidth(); |
|
338 |
} |
|
339 |
double p=(ws-lblTexto.getWidth()-20)/total; |
|
340 |
*/ |
|
341 |
for (int i=0;i<labels.length;i++){ |
|
342 |
//if (labels[i] instanceof JLabel){ |
|
343 |
JLabel label=(JLabel)labels[i]; |
|
344 |
label.setText(""); |
|
345 |
//} |
|
346 |
} |
|
347 |
} |
|
348 |
/** |
|
349 |
* |
|
275 |
getProgressBar().repaint(); |
|
276 |
} |
|
277 |
|
|
278 |
/** |
|
279 |
* DOCUMENT ME! |
|
280 |
* |
|
281 |
* @param labels DOCUMENT ME! |
|
350 | 282 |
*/ |
283 |
public void setLabelSet(Label[] labels) { |
|
284 |
removeAllLabels(); |
|
285 |
idLabel.clear(); |
|
286 |
|
|
287 |
for (int i = 0; i < labels.length; i++) { |
|
288 |
JLabel lbl = new JLabel(); |
|
289 |
lbl.setPreferredSize(new Dimension(labels[i].getSize(), |
|
290 |
this.getHeight())); |
|
291 |
lbl.setSize(new Dimension(labels[i].getSize(), this.getHeight())); |
|
292 |
lbl.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); |
|
293 |
this.add(lbl); |
|
294 |
|
|
295 |
/* if (i != labels.length - 1){ |
|
296 |
this.add(new JSeparator(JSeparator.VERTICAL)); |
|
297 |
} |
|
298 |
*/ |
|
299 |
idLabel.put(labels[i].getId(), lbl); |
|
300 |
} |
|
301 |
|
|
302 |
JLabel[] configlabels = (JLabel[]) idLabel.values().toArray(new JLabel[0]); |
|
303 |
widthlabels = new int[configlabels.length]; |
|
304 |
|
|
305 |
for (int i = 0; i < labels.length; i++) { |
|
306 |
widthlabels[i] = configlabels[i].getWidth(); |
|
307 |
} |
|
308 |
|
|
309 |
this.repaint(); |
|
310 |
} |
|
311 |
|
|
312 |
/** |
|
313 |
* Los Labels que estan sin texto no se a?aden a la barra y su espacio es |
|
314 |
* utilizado por otros labels. Si se quiere acer en un futuro la |
|
315 |
* asignaci?n de espacio de los elementos que se a?adan a la barra se |
|
316 |
* puede hacer aqu?. |
|
317 |
*/ |
|
318 |
public void ajustar() { |
|
319 |
if (widthlabels == null) { |
|
320 |
return; |
|
321 |
} |
|
322 |
|
|
323 |
int ws = this.getWidth(); |
|
324 |
|
|
325 |
JLabel[] labels = (JLabel[]) idLabel.values().toArray(new JLabel[0]); |
|
326 |
|
|
327 |
/* double total = 1; |
|
328 |
for (int i = 0; i < widthlabels.length; i++) { |
|
329 |
if (labels[i].getText().compareTo("") != 0) { |
|
330 |
total += widthlabels[i]; |
|
331 |
} |
|
332 |
} |
|
333 |
double p = (ws - lblTexto.getWidth() - 20) / total; |
|
334 |
*/ |
|
335 |
for (int i = 0; i < labels.length; i++) { |
|
336 |
//if (labels[i] instanceof JLabel){ |
|
337 |
JLabel label = (JLabel) labels[i]; |
|
338 |
|
|
339 |
if (label.getText().compareTo("") != 0) { |
|
340 |
label.setVisible(true); |
|
341 |
label.setPreferredSize(new Dimension((int) (widthlabels[i]), |
|
342 |
this.getHeight())); |
|
343 |
} else { |
|
344 |
label.setVisible(false); |
|
345 |
|
|
346 |
//label.setPreferredSize(new Dimension(0,this.getHeight())); |
|
347 |
} |
|
348 |
|
|
349 |
//} |
|
350 |
} |
|
351 |
} |
|
352 |
|
|
353 |
/** |
|
354 |
* |
|
355 |
*/ |
|
351 | 356 |
private void removeAllLabels() { |
352 | 357 |
Component[] labels = this.getComponents(); |
353 |
|
|
358 |
|
|
354 | 359 |
for (int i = 0; i < labels.length; i++) { |
355 |
if ( (labels[i] != lblIcon) && |
|
356 |
(labels[i] != lblTexto)){ |
|
360 |
if ((labels[i] != lblIcon) && (labels[i] != lblTexto)) { |
|
357 | 361 |
remove(labels[i]); |
358 | 362 |
} |
359 | 363 |
} |
360 | 364 |
} |
361 | 365 |
|
362 | 366 |
/** |
363 |
* Establece el texto de una de las etiquetas
|
|
364 |
*
|
|
365 |
* @param id Identificador de las etiquetas
|
|
366 |
* @param msg Mensaje que se quiere poner en la etiqueta
|
|
367 |
*/
|
|
368 |
public void setMessage(String id, String msg) {
|
|
369 |
JLabel lbl = (JLabel) idLabel.get(id);
|
|
367 |
* Establece el texto de una de las etiquetas
|
|
368 |
*
|
|
369 |
* @param id Identificador de las etiquetas
|
|
370 |
* @param msg Mensaje que se quiere poner en la etiqueta
|
|
371 |
*/
|
|
372 |
public void setMessage(String id, String msg) {
|
|
373 |
JLabel lbl = (JLabel) idLabel.get(id);
|
|
370 | 374 |
|
371 |
if (lbl == null) { |
|
372 |
logger.debug("no label called " + id); |
|
373 |
}else{ |
|
374 |
lbl.setText(msg); |
|
375 |
} |
|
376 |
ajustar(); |
|
377 |
} |
|
375 |
if (lbl == null) { |
|
376 |
logger.debug("no label called " + id); |
|
377 |
} else { |
|
378 |
lbl.setText(msg); |
|
379 |
} |
|
378 | 380 |
|
379 |
/** |
|
380 |
* This method initializes progressBar |
|
381 |
* |
|
382 |
* @return javax.swing.JProgressBar |
|
383 |
*/ |
|
384 |
private JProgressBar getProgressBar() { |
|
385 |
if (progressBar == null) { |
|
386 |
progressBar = new JProgressBar(); |
|
387 |
progressBar.setPreferredSize(new java.awt.Dimension(200, 14)); |
|
388 |
progressBar.setVisible(false); |
|
389 |
progressBar.setMinimum(0); |
|
390 |
progressBar.setMaximum(100); |
|
391 |
} |
|
381 |
ajustar(); |
|
382 |
} |
|
392 | 383 |
|
393 |
return progressBar; |
|
394 |
} |
|
384 |
/** |
|
385 |
* This method initializes progressBar |
|
386 |
* |
|
387 |
* @return javax.swing.JProgressBar |
|
388 |
*/ |
|
389 |
private JProgressBar getProgressBar() { |
|
390 |
if (progressBar == null) { |
|
391 |
progressBar = new JProgressBar(); |
|
392 |
progressBar.setPreferredSize(new java.awt.Dimension(200, 14)); |
|
393 |
progressBar.setVisible(false); |
|
394 |
progressBar.setMinimum(0); |
|
395 |
progressBar.setMaximum(100); |
|
396 |
} |
|
395 | 397 |
|
398 |
return progressBar; |
|
399 |
} |
|
400 |
|
|
396 | 401 |
/** |
402 |
* DOCUMENT ME! |
|
403 |
* |
|
397 | 404 |
* @param d |
398 | 405 |
*/ |
399 | 406 |
public void setFixedLabelWidth(double d) { |
Also available in: Unified diff