}
private void nodeResourceMapped(Node node, XmlElement event, boolean forward) {
String resource = MonitorUtil.getMappedResource(event);
String retryCount = MonitorUtil.getRetryCount(event);
NodeGUI nodeGUI = node.getGUI();
if (forward) {
LinkedList<ResourcePaintable> paintables = this.resourcePaintableMap.get(node);
if (paintables == null) {
paintables = new LinkedList<ResourcePaintable>();
this.resourcePaintableMap.put(node, paintables);
}
if (paintables.size() > 0) {
// Remove the previous one.
ResourcePaintable previousPaintable = paintables.getLast();
nodeGUI.removePaintable(previousPaintable);
}
ResourcePaintable paintable = new ResourcePaintable(resource, retryCount);
paintables.addLast(paintable);
nodeGUI.addPaintable(paintable);
} else {
LinkedList<ResourcePaintable> paintables = this.resourcePaintableMap.get(node);
if (paintables == null) {
paintables = new LinkedList<ResourcePaintable>();
this.resourcePaintableMap.put(node, paintables);
}
if (paintables.size() > 0) {
// Remove the last one.
ResourcePaintable lastPaintable = paintables.removeLast();
nodeGUI.removePaintable(lastPaintable);
}
if (paintables.size() > 0) {
// Add the previous one.
ResourcePaintable previousPaintable = paintables.getLast();
nodeGUI.addPaintable(previousPaintable);
}
}
}