Revision 12011

View differences:

branches/v10/frameworks/_fwAndami/src/com/iver/andami/ui/mdiFrame/NewStatusBar.java
62 62

  
63 63

  
64 64
/**
65
 * <p>This class contains the status bar. It contains the graphical component,
66
 * and the methods to manage it.
67
 * </p>
68
 * 
69
 * <p>The status bar is divided in several areas. At the very left, there is
70
 * an icon and the main status text. There are three icons to show:
71
 * Info, Warning and Error icons. They can be set together with the main
72
 * status text using the methods <code>setInfoText()</code>,
73
 * <code>setWarningText()</code> and <code>setErrorText()</code> (and also with
74
 * <code>setInfoTextTemporal()</code>, etc). Then, there is a right area which
75
 * contains labels and other controls. Labels are set in the config.xml files
76
 * and are visible or not depending on the currently selected Andami window.
77
 * Controls are associated to extensions, and are enabled/disabled and
78
 * visible/hidden depending on the associated extension.
79
 * </p>
80
 * 
65 81
 */
66 82
public class NewStatusBar extends JPanel {
67 83
	private static Logger logger = Logger.getLogger(NewStatusBar.class.getName());
......
98 114
	}
99 115

  
100 116
	/**
101
	 * This method initializes this
117
	 * This method initializes the status bar. It creates the required
118
	 * containers and sets the layout.
102 119
	 */
103 120
	private void initialize() {
104 121
		BorderLayout mainLayout = new BorderLayout();
......
136 153
	}
137 154

  
138 155
	/**
139
	 * Obtiene el texto de la barra de estado
156
	 * Gets the status bar main text.
140 157
	 *
141
	 * @return texto
158
	 * @return The status bar main text.
159
	 * @see #setInfoText(String)
160
	 * @see #setWarningText(String)
161
	 * @see #setErrorText(String)
162
	 * @see #setInfoTextTemporal(String)
163
	 * @see #setWarningTextTemporal(String)
164
	 * @see #setErrorTextTemporal(String)
142 165
	 */
143 166
	public String getStatusText() {
144 167
		return lblTexto.getText();
145 168
	}
146 169

  
147 170
	/**
148
	 * Restaura el contenido permanente de la barra de estado
171
	 * Restores the previous contents in the status bar main text,
172
	 * after the {@link #setInfoTextTemporal(String)}, {@link #setWarningTextTemporal(String)}
173
	 * or {@link #setErrorTextTemporal(String)} have been called.
174
	 * 
175
	 * @see #setInfoTextTemporal(String)
176
	 * @see #setWarningTextTemporal(String)
177
	 * @see #setErrorTextTemporal(String)
149 178
	 */
150 179
	public void restaurarTexto() {
151 180
		contenidoTemporal = false;
......
176 205
	}
177 206

  
178 207
	/**
179
	 * Establece el texto de la barra de estado de forma temporal. Se almacena
180
	 * el texto que hab?a en la barra de estado.
208
	 * Sets a temporary information message in the status bar, and changes the
209
	 * icon to an Info icon. The previous text and icon can be restored using
210
	 * the {@link #restaurarTexto()} method.
181 211
	 *
182
	 * @param texto texto
212
	 * @param texto The text to set
213
	 * @see #restaurarTexto()
183 214
	 */
184 215
	public void setInfoTextTemporal(String texto) {
185 216
		contenidoTemporal = true;
......
193 224
	}
194 225

  
195 226
	/**
196
	 * Establece el texto de la barra de estado de forma temporal. Se almacena
197
	 * el texto que hab?a en la barra de estado.
227
	 * Sets a temporary warning message in the status bar, and changes the
228
	 * icon to a Warning icon. The previous text and icon can be restored using
229
	 * the {@link #restaurarTexto()} method.
198 230
	 *
199
	 * @param texto texto
231
	 * @param texto The text to set
232
	 * @see #restaurarTexto()
200 233
	 */
201 234
	public void setWarningTextTemporal(String texto) {
202 235
		contenidoTemporal = true;
......
210 243
	}
211 244

  
212 245
	/**
213
	 * Establece el texto de la barra de estado de forma temporal. Se almacena
214
	 * el texto que hab?a en la barra de estado.
246
	 * Sets a temporary error message in the status bar, and changes the
247
	 * icon to an Error icon. The previous text and icon can be restored using
248
	 * the {@link #restaurarTexto()} method.
215 249
	 *
216
	 * @param texto texto
250
	 * @param texto The text to set
251
	 * @see #restaurarTexto()
217 252
	 */
218 253
	public void setErrorTextTemporal(String texto) {
219 254
		contenidoTemporal = true;
......
227 262
	}
228 263

  
229 264
	/**
230
	 * Establece el texto de la barar de manera permanente. Si se est?
231
	 * mostrando texto de forma temporal no se actualiza la interfaz
265
	 * Sets a permanent info message in the status bar, and changes the
266
	 * permanent icon to an Info icon. If there is a temporary message showing
267
	 * at the moment, the message set now is not shown until
268
	 * the {@link #restaurarTexto()} method is called.
232 269
	 *
233
	 * @param texto Texto
270
	 * @param texto The permanent info message to set
271
	 * @see #restaurarTexto()
234 272
	 */
235 273
	public void setInfoText(String texto) {
236 274
		if (contenidoTemporal) {
......
244 282
	}
245 283

  
246 284
	/**
247
	 * Establece el texto de la barar de manera permanente. Si se est?
248
	 * mostrando texto de forma temporal no se actualiza la interfaz
285
	 * Sets a permanent warning message in the status bar, and changes the
286
	 * permanent icon to a Warning icon. If there is a temporary message showing
287
	 * at the moment, the message set now is not shown until
288
	 * the {@link #restaurarTexto()} method is called.
249 289
	 *
250
	 * @param texto Texto
290
	 * @param texto The permanent warning message to set
291
	 * @see #restaurarTexto()
251 292
	 */
252 293
	public void setWarningText(String texto) {
253 294
		if (contenidoTemporal) {
......
261 302
	}
262 303

  
263 304
	/**
264
	 * Establece el texto de la barar de manera permanente. Si se est?
265
	 * mostrando texto de forma temporal no se actualiza la interfaz
305
	 * Sets a permanent error message in the status bar, and changes the
306
	 * permanent icon to an Error icon. If there is a temporary message showing
307
	 * at the moment, the message set now is not shown until
308
	 * the {@link #restaurarTexto()} method is called.
266 309
	 *
267
	 * @param texto Texto
310
	 * @param texto The permanent info message to set
311
	 * @see #restaurarTexto()
268 312
	 */
269 313
	public void setErrorText(String texto) {
270 314
		if (contenidoTemporal) {
......
278 322
	}
279 323

  
280 324
	/**
281
	 * Establece el porcentaje en la barra de progreso. Si es 100 se oculta la
282
	 * barra
325
	 * If <code>p</code> is a value between 0 and 99, it shows a progress bar
326
	 * in the left area of the status bar, and sets the specified progress.
327
	 * If <code>p</code> is bigger than 99, it hides the progress bar.
283 328
	 *
284
	 * @param p DOCUMENT ME!
329
	 * @param p The progress to set in the progress bar. If it is bigger
330
	 * than 99, the task will be considered to be finished, and the
331
	 * progress bar will be hidden.
285 332
	 */
286 333
	public void setProgress(int p) {
287 334
		if (p < 100) {
......
294 341
		getProgressBar().repaint();
295 342
	}
296 343

  
297
	/*public void setControls(Label[] labels, ArrayList controlArray) {
298
		removeAllLabels();
299
		if (labels!=null)
300
			setLabelSet(labels);
301
		if (controlArray!=null)
302
			setControls(controlArray);
303
		this.repaint();
304
	}*/
305

  
344
	/**
345
	 * Sets a label-set to be shown in the status bar. This method it is not
346
	 * intended to be used directly, because the set will be overwritten when the selected
347
	 * window changes. Use {@link MainFrame#setStatusBarLabels(Class, Label[])}
348
	 * to permanently associate a label set with a window.
349
	 * 
350
	 * @param labels The labels to set.
351
	 * @see MainFrame#setStatusBarLabels(Class, Label[])
352
	 */
306 353
	public void setLabelSet(Label[] labels) {
307 354
		removeAllLabels();
308 355
		idLabel.clear();
......
332 379
		this.repaint();
333 380
	}
334 381

  
335
	/*public void setControls(ArrayList controlList) {
336

  
337
		for (int i = 0; i < controlList.size(); i++) {
338
			Component control = (Component) controlList.get(i);
339
			control.setVisible(true);
340
			control.setEnabled(true);
341
			this.add(control);
342
		}
343
	}*/
344

  
345 382
	/**
346
	 * Los Labels que estan sin texto no se a?aden a la barra y su espacio es
347
	 * utilizado por otros labels. Si se quiere hacer en un futuro la
348
	 * asignaci?n de espacio de los elementos que se a?adan a la barra se
349
	 * puede hacer aqu?.
383
	 * Hides the empty labels and adjust the space in the bar.
350 384
	 */
351 385
	public void ajustar() {
352 386
		if (widthlabels == null) {
......
384 418
	}
385 419

  
386 420
	/**
387
	 * Removes all the labels from the status bar.
421
	 * Removes all the labels from the status bar. It does not remove the
422
	 * controls.
388 423
	 */
389 424
	private void removeAllLabels() {
390 425
		Component[] controlArray = controlContainer.getComponents();
......
411 446
	}
412 447

  
413 448
	/**
414
	 * Establece el texto de una de las etiquetas
449
	 * Sets the text of the provided label.
415 450
	 *
416
	 * @param id Identificador de las etiquetas
417
	 * @param msg Mensaje que se quiere poner en la etiqueta
451
	 * @param id The ID of the label to modify. It is defined in the
452
	 * config.xml file
453
	 * @param msg The message to show in the label
418 454
	 */
419 455
	public void setMessage(String id, String msg) {
420 456
		JLabel lbl = (JLabel) idLabel.get(id);
......
436 472
	/**
437 473
	 * Sets the control identified by 'id' with the provided value.
438 474
	 *
439
	 * @param id
440
	 * @param value
475
	 * @param id The ID of the control to modify
476
	 * @param value The value to set in the control
441 477
	 */
442 478
	public void setControlValue(String id, String value) {
443 479
		IControl control = (IControl) controls.get(id);
......
450 486
	}
451 487

  
452 488
	/**
453
	 * This method initializes progressBar
489
	 * This method initializes the progressBar and gets it.
454 490
	 *
455 491
	 * @return javax.swing.JProgressBar
456 492
	 */
......
471 507
	 * DOCUMENT ME!
472 508
	 *
473 509
	 * @param d
510
	 * @deprecated
474 511
	 */
475 512
	public void setFixedLabelWidth(double d) {
476 513
	//	lblTexto.setPreferredSize(new Dimension((int) d, lblTexto.getHeight()));
......
478 515

  
479 516
	/**
480 517
	 * Adds a control to the status bar
518
	 * 
519
	 * @param id The ID of the control, useful to later retrive it or set its value
520
	 * @param control The control to add
481 521
	 */
482 522
	public void addControl(String id, Component control) {
483 523
		controlContainer.add(control);
......
489 529

  
490 530
	/**
491 531
	 * Gets a control from the status bar
532
	 * 
533
	 * @param id The ID of the control to get
492 534
	 */
493 535
	public Component getControl(String id, Component control) {
494 536
		return (Component) controls.get(id);

Also available in: Unified diff