60 |
|
public boolean update(XMLPacket packet) { |
61 |
|
// iterate over the packets data |
62 |
|
boolean displaySucessful = true; |
63 |
< |
String queueName = packet.getParam("packet.attributes.name"); |
63 |
> |
String queueHashCode = packet.getParam("packet.attributes.hashCode"); |
64 |
|
|
65 |
|
// if there are no components looking after this data |
66 |
|
// create a new StringDataComponent for it |
67 |
< |
if(!_queues.containsKey(queueName)) { |
67 |
> |
if(!_queues.containsKey(queueHashCode)) { |
68 |
|
addQueue(packet); |
69 |
|
} |
70 |
|
|
84 |
|
private void addQueue(XMLPacket packet) { |
85 |
|
HashMap newQueue = new HashMap(); |
86 |
|
String queueName = packet.getParam("packet.attributes.name"); |
87 |
+ |
String queueHashCode = packet.getParam("packet.attributes.hashCode"); |
88 |
|
VisibleDataComponent date = new DateDataComponent("Last timestamp", "packet.attributes.date"); |
89 |
|
VisibleDataComponent total = new StringDataComponent("Total queued to date", "packet.queue.attributes.total"); |
90 |
+ |
VisibleDataComponent hashCode = new StringDataComponent("Internal hash code", "packet.attributes.hashCode"); |
91 |
|
newQueue.put("packet.attributes.name", new StringDataComponent("Name", "packet.attributes.name")); |
92 |
|
newQueue.put("packet.queue.attributes.total", total); |
93 |
|
newQueue.put("packet.attributes.date", date); |
94 |
+ |
newQueue.put("packet.attributes.hashCode", hashCode); |
95 |
|
JPanel newQueueDisplay = new JPanel(); |
96 |
|
newQueueDisplay.setLayout(new BoxLayout(newQueueDisplay, BoxLayout.Y_AXIS)); |
97 |
|
newQueueDisplay.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 102)), queueName)); |
98 |
|
newQueueDisplay.add(date); |
99 |
|
newQueueDisplay.add(total); |
100 |
+ |
newQueueDisplay.add(hashCode); |
101 |
|
_queuesDisplays.put(queueName, newQueueDisplay); |
102 |
|
try { |
103 |
|
SwingSafeAdd task = new SwingSafeAdd(_content, newQueueDisplay); |
106 |
|
// don't care |
107 |
|
} |
108 |
|
pack(); |
109 |
< |
_queues.put(queueName, newQueue); |
109 |
> |
_queues.put(queueHashCode, newQueue); |
110 |
|
} |
111 |
|
|
112 |
|
private void updateQueueInformation(XMLPacket packet) throws DataFormatException { |
113 |
< |
String queueName = packet.getParam("packet.attributes.name"); |
113 |
> |
String queueHashCode = packet.getParam("packet.attributes.hashCode"); |
114 |
|
|
115 |
|
// if it was a shutdown packet, remove the display |
116 |
|
if (packet.getParam("packet.attributes.shutdown") != null) { |
117 |
|
// *** !!! MAY NOT BE SWING SAFE !!! *** |
118 |
< |
JPanel temp = (JPanel)_queuesDisplays.get(queueName); |
118 |
> |
JPanel temp = (JPanel)_queuesDisplays.get(queueHashCode); |
119 |
|
temp.setVisible(false); |
120 |
|
_content.remove(temp); |
121 |
|
_queuesDisplays.remove(temp); |
123 |
|
|
124 |
|
// else update the display |
125 |
|
} else { |
126 |
< |
HashMap components = (HashMap) _queues.get(queueName); |
126 |
> |
HashMap components = (HashMap) _queues.get(queueHashCode); |
127 |
|
Set packetSet = packet.getSet(); |
128 |
|
Iterator i = packetSet.iterator(); |
129 |
|
while (i.hasNext()) { |
136 |
|
VisibleDataComponent queue = new StringDataComponent("Current length of " + dataKey.substring(dataKey.lastIndexOf('.') + 1), dataKey); |
137 |
|
components.put(dataKey, queue); |
138 |
|
try { |
139 |
< |
SwingSafeAdd task = new SwingSafeAdd((JPanel)_queuesDisplays.get(queueName), queue); |
139 |
> |
SwingSafeAdd task = new SwingSafeAdd((JPanel)_queuesDisplays.get(queueHashCode), queue); |
140 |
|
SwingUtilities.invokeAndWait(task); |
141 |
|
} catch (Exception e) { |
142 |
|
// don't care |