for (Iterator it = uidl.getChildIterator(); it.hasNext();) {
UIDL uidlForChild = (UIDL) it.next();
Widget child = client.getWidget(uidlForChild);
- ((Paintable)child).updateFromUIDL(uidlForChild, client);
uidlWidgets.add(child);
}
Iterator oldIt = oldWidgets.iterator();
Iterator newIt = uidlWidgets.iterator();
+ Iterator newUidl = uidl.getChildIterator();
Widget oldChild = null;
while(newIt.hasNext()) {
Widget child = (Widget) newIt.next();
+ UIDL childUidl = (UIDL) newUidl.next();
if(oldChild == null && oldIt.hasNext()) {
// search for next old Paintable which still exists in layout
// and delete others
if(oldChild == null) {
// we are adding components to layout
add(child);
- continue;
- }
- if(child == oldChild) {
+ } else if(child == oldChild) {
// child already attached and updated
oldChild = null;
- continue;
- }
- if(hasChildComponent(child)) {
- // current child has been moved
- this.insert(child, getWidgetIndex(oldChild));
+ } else if(hasChildComponent(child)) {
+ // current child has been moved, re-insert before current oldChild
+ removeCaption(child);
+ int index = getWidgetIndex(oldChild);
+ if(componentToCaption.containsKey(oldChild))
+ index--;
+ this.insert(child, index);
}
+ ((Paintable)child).updateFromUIDL(childUidl, client);
+
}
// remove possibly remaining old Paintable object which were not updated
while(oldIt.hasNext()) {
}
}
+ public void removeCaption(Widget w) {
+ Caption c = (Caption) componentToCaption.get(w);
+ if(c != null) {
+ this.remove(c);
+ componentToCaption.remove(w);
+ }
+ }
-
}