Revision 281 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/StatusLabel.java
StatusLabel.java | ||
---|---|---|
33 | 33 |
*/ |
34 | 34 |
package org.gvsig.tools.swing.impl.dynobject; |
35 | 35 |
|
36 |
import java.awt.BorderLayout; |
|
36 | 37 |
import java.awt.Color; |
37 | 38 |
import java.awt.Component; |
39 |
import java.awt.Dimension; |
|
38 | 40 |
|
39 | 41 |
import javax.swing.Icon; |
40 | 42 |
import javax.swing.ImageIcon; |
41 | 43 |
import javax.swing.JLabel; |
44 |
import javax.swing.JPanel; |
|
42 | 45 |
|
43 | 46 |
import org.gvsig.tools.swing.api.dynobject.ValueChangedListener; |
44 | 47 |
import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent; |
45 | 48 |
|
46 | 49 |
/** |
47 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
48 | 50 |
* |
51 |
* JLabel with a "not validated" image, whose validation is validated and shown |
|
52 |
* whenever the listener is triggered. |
|
53 |
* |
|
54 |
* @author 2010 - <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG Team |
|
55 |
* @author 2010 - <a href="mailto:reinhold@uji.es">Cristian Mart?n </a> - gvSIG Team |
|
56 |
* @version $Id$ |
|
57 |
* |
|
49 | 58 |
*/ |
50 | 59 |
public class StatusLabel extends JLabel implements ValueChangedListener { |
51 | 60 |
|
... | ... | |
54 | 63 |
private static final Color COLOR_MANDATORY = Color.RED; |
55 | 64 |
private JLabel validationLabel; |
56 | 65 |
|
66 |
private JPanel validationPanel; |
|
67 |
|
|
57 | 68 |
public StatusLabel(String text, boolean isMandatory) { |
58 | 69 |
validationLabel = new JLabel(); |
59 | 70 |
validationLabel.setOpaque(true); |
... | ... | |
108 | 119 |
if (!field.isValid()) { |
109 | 120 |
validationLabel.setIcon(getIcon(NOT_VALIDATED, "Not Validated")); |
110 | 121 |
} else { |
111 |
setIcon(null); |
|
122 |
validationLabel.setIcon(null);
|
|
112 | 123 |
} |
113 | 124 |
} |
114 | 125 |
|
126 |
public Component getValidationLabel(){ |
|
127 |
return this.validationLabel; |
|
128 |
} |
|
129 |
|
|
115 | 130 |
/** |
116 | 131 |
* @return |
117 | 132 |
*/ |
118 |
public Component getValidationLabel() { |
|
119 |
return this.validationLabel; |
|
133 |
public Component getValidationPanel() { |
|
134 |
if (validationPanel==null){ |
|
135 |
validationPanel = new JPanel(new BorderLayout()); |
|
136 |
validationPanel.setSize(new Dimension(15,15)); |
|
137 |
validationPanel.setOpaque(true); |
|
138 |
validationPanel.add(validationLabel,BorderLayout.LINE_START); |
|
139 |
} |
|
140 |
return this.validationPanel; |
|
120 | 141 |
} |
121 | 142 |
} |
Also available in: Unified diff