6 |
|
import javax.swing.JTextField; |
7 |
|
import java.awt.GridLayout; |
8 |
|
import javax.swing.SwingUtilities; |
9 |
+ |
import uk.org.iscream.util.XMLPacket; |
10 |
|
|
11 |
|
/** |
12 |
|
* This is the most basic of DataComponents. |
53 |
|
_item.setText("-uninitialised-"); |
54 |
|
add(_label); |
55 |
|
add(_item); |
56 |
+ |
setVisible(false); |
57 |
|
} |
58 |
|
|
59 |
|
//---PUBLIC METHODS--- |
65 |
|
* run this method. |
66 |
|
*/ |
67 |
|
public void run() { |
68 |
< |
_item.setText(_cache); |
68 |
> |
if(!isVisible()) { |
69 |
> |
setVisible(true); |
70 |
> |
} |
71 |
> |
_item.setText(_cache); |
72 |
|
} |
73 |
|
|
74 |
|
/** |
86 |
|
//---ACCESSOR/MUTATOR METHODS--- |
87 |
|
|
88 |
|
/** |
89 |
< |
* This takes the String value of the parameter that this component |
85 |
< |
* is monitoring direct from the packet, it then performs all |
89 |
> |
* This takes the packet to obtain the value from, it then performs all |
90 |
|
* approriate conversions and adds this class to the Swing Event |
91 |
|
* Dispatching queue. |
92 |
|
* |
93 |
< |
* @param value the value for this data component |
93 |
> |
* @param packet the XMLPacket to get the data from |
94 |
|
* @throws DataFormatException if there was a problem converting the data for display |
95 |
|
*/ |
96 |
< |
public void setValue(String value) throws DataFormatException { |
96 |
> |
public void setValue(XMLPacket packet) throws DataFormatException { |
97 |
> |
String value = packet.getParam(_attribute); |
98 |
|
try { |
99 |
|
if(!_cache.equals(value)) { |
100 |
|
_cache = value; |
143 |
|
protected JLabel _label; |
144 |
|
|
145 |
|
/** |
146 |
< |
* Remebers what the last value was, so we |
146 |
> |
* Remembers what the last value was, so we |
147 |
|
* only update if we have to. |
148 |
|
*/ |
149 |
< |
String _cache = ""; |
149 |
> |
protected String _cache = ""; |
150 |
|
|
151 |
|
/** |
152 |
|
* The length of the JTextField |