Revision 10400 trunk/frameworks/_fwAndami/src/com/iver/andami/ui/mdiFrame/NewStatusBar.java
NewStatusBar.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.andami.ui.mdiFrame; |
42 | 42 |
|
43 |
import java.awt.BorderLayout; |
|
43 | 44 |
import java.awt.Component; |
44 | 45 |
import java.awt.Dimension; |
45 | 46 |
import java.awt.FlowLayout; |
... | ... | |
50 | 51 |
import javax.swing.JLabel; |
51 | 52 |
import javax.swing.JPanel; |
52 | 53 |
import javax.swing.JProgressBar; |
54 |
import javax.swing.SwingConstants; |
|
53 | 55 |
import javax.swing.border.BevelBorder; |
54 | 56 |
|
55 | 57 |
import org.apache.log4j.Logger; |
... | ... | |
79 | 81 |
private HashMap idLabel = new HashMap(); |
80 | 82 |
private int[] widthlabels = null; |
81 | 83 |
private HashMap controls = new HashMap(); |
82 |
|
|
84 |
private JPanel controlContainer; |
|
83 | 85 |
/** |
84 | 86 |
* This is the default constructor |
85 | 87 |
*/ |
... | ... | |
98 | 100 |
* This method initializes this |
99 | 101 |
*/ |
100 | 102 |
private void initialize() { |
103 |
BorderLayout mainLayout = new BorderLayout(); |
|
104 |
this.setLayout(mainLayout); |
|
105 |
|
|
106 |
JPanel container1 = new JPanel(); |
|
107 |
this.add(container1, BorderLayout.CENTER); |
|
108 |
controlContainer = new JPanel(); |
|
109 |
this.add(controlContainer, BorderLayout.EAST); |
|
110 |
|
|
101 | 111 |
this.setPreferredSize(new java.awt.Dimension(183,20)); |
102 | 112 |
this.setSize(new java.awt.Dimension(183,20)); |
103 | 113 |
lblIcon = new JLabel(); |
104 | 114 |
lblTexto = new JLabel(); |
115 |
lblTexto.setAlignmentX(JLabel.LEFT_ALIGNMENT); |
|
116 |
lblTexto.setHorizontalAlignment(SwingConstants.LEFT); |
|
117 |
lblTexto.setHorizontalTextPosition(SwingConstants.LEFT); |
|
105 | 118 |
|
106 |
FlowLayout flowLayout2 = new FlowLayout();
|
|
107 |
this.setLayout(flowLayout2);
|
|
108 |
flowLayout2.setHgap(1);
|
|
109 |
flowLayout2.setVgap(2);
|
|
110 |
flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
|
|
119 |
FlowLayout rightLayout = new FlowLayout();
|
|
120 |
controlContainer.setLayout(rightLayout);
|
|
121 |
rightLayout.setHgap(1);
|
|
122 |
rightLayout.setVgap(2);
|
|
123 |
rightLayout.setAlignment(java.awt.FlowLayout.RIGHT);
|
|
111 | 124 |
lblIcon.setText(""); |
112 | 125 |
lblTexto.setText(Messages.getString("StatusBar.Aplicacion_iniciada")); |
113 |
this.add(lblIcon, null); |
|
114 |
this.add(getProgressBar(), null); |
|
115 |
this.add(lblTexto, null); |
|
126 |
|
|
127 |
FlowLayout leftLayout = new FlowLayout(FlowLayout.LEFT); |
|
128 |
leftLayout.setHgap(1); |
|
129 |
leftLayout.setVgap(2); |
|
130 |
container1.setLayout(leftLayout); |
|
131 |
container1.add(lblIcon, null); |
|
132 |
container1.add(getProgressBar(), null); |
|
133 |
container1.add(lblTexto, null); |
|
116 | 134 |
} |
117 | 135 |
|
118 | 136 |
/** |
... | ... | |
293 | 311 |
this.getHeight() - 2)); |
294 | 312 |
lbl.setSize(new Dimension(labels[i].getSize(), this.getHeight() - 2)); |
295 | 313 |
lbl.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); |
296 |
this.add(lbl);
|
|
314 |
controlContainer.add(lbl);
|
|
297 | 315 |
|
298 | 316 |
/* if (i != labels.length - 1){ |
299 | 317 |
this.add(new JSeparator(JSeparator.VERTICAL)); |
... | ... | |
367 | 385 |
* Removes all the labels from the status bar. |
368 | 386 |
*/ |
369 | 387 |
private void removeAllLabels() { |
370 |
Component[] controlArray = this.getComponents();
|
|
388 |
Component[] controlArray = controlContainer.getComponents();
|
|
371 | 389 |
|
372 | 390 |
for (int i = 0; i < controlArray.length; i++) { |
373 | 391 |
if ((controlArray[i] != lblIcon) && (controlArray[i] != lblTexto && controlArray[i] instanceof JLabel)) { |
374 |
remove(controlArray[i]); |
|
392 |
controlContainer.remove(controlArray[i]);
|
|
375 | 393 |
} |
376 | 394 |
} |
377 | 395 |
} |
... | ... | |
381 | 399 |
* Removes all the controls (including labels) from the status bar. |
382 | 400 |
*/ |
383 | 401 |
private void removeAllControls() { |
384 |
Component[] controlArray = this.getComponents();
|
|
402 |
Component[] controlArray = controlContainer.getComponents();
|
|
385 | 403 |
|
386 | 404 |
for (int i = 0; i < controlArray.length; i++) { |
387 | 405 |
if ((controlArray[i] != lblIcon) && (controlArray[i] != lblTexto)) { |
388 |
remove(controlArray[i]); |
|
406 |
controlContainer.remove(controlArray[i]);
|
|
389 | 407 |
} |
390 | 408 |
} |
391 | 409 |
} |
... | ... | |
455 | 473 |
* Adds a control to the status bar |
456 | 474 |
*/ |
457 | 475 |
public void addControl(String id, Component control) { |
458 |
this.add(control);
|
|
476 |
controlContainer.add(control);
|
|
459 | 477 |
if (!controls.containsKey(control.getName())) |
460 | 478 |
controls.put(control.getName(), control); |
461 | 479 |
else |
Also available in: Unified diff