return;
}
// Draw this application level window
UIDL childUidl = uidl.getChildUIDL(childIndex);
final Paintable lo = client.getPaintable(childUidl);
if (layout != null) {
if (layout != lo) {
// remove old
client.unregisterPaintable(layout);
// add new
setWidget((Widget) lo);
layout = lo;
}
} else {
setWidget((Widget) lo);
layout = lo;
}
layout.updateFromUIDL(childUidl, client);
if (!childUidl.getBooleanAttribute("cached")) {
updateParentFrameSize();
}
// Update subwindows
final HashSet<VWindow> removedSubWindows = new HashSet<VWindow>(
subWindows);
// Open new windows
while ((childUidl = uidl.getChildUIDL(childIndex++)) != null) {
if ("window".equals(childUidl.getTag())) {
final Paintable w = client.getPaintable(childUidl);
if (subWindows.contains(w)) {
removedSubWindows.remove(w);
} else {
subWindows.add((VWindow) w);
}
w.updateFromUIDL(childUidl, client);
} else if ("actions".equals(childUidl.getTag())) {
if (actionHandler == null) {
actionHandler = new ShortcutActionHandler(id, client);
}
actionHandler.updateActionMap(childUidl);
} else if (childUidl.getTag().equals("notifications")) {
for (final Iterator it = childUidl.getChildIterator(); it
.hasNext();) {
final UIDL notification = (UIDL) it.next();
String html = "";
if (notification.hasAttribute("icon")) {
final String parsedUri = client
.translateVaadinUri(notification
.getStringAttribute("icon"));
html += "<IMG src=\"" + parsedUri + "\" />";
}
if (notification.hasAttribute("caption")) {
html += "<H1>"
+ notification.getStringAttribute("caption")
+ "</H1>";
}
if (notification.hasAttribute("message")) {
html += "<p>"
+ notification.getStringAttribute("message")
+ "</p>";
}
final String style = notification.hasAttribute("style") ? notification
.getStringAttribute("style")
: null;
final int position = notification
.getIntAttribute("position");
final int delay = notification.getIntAttribute("delay");
new VNotification(delay).show(html, position, style);
}
}
}
// Close old windows
for (final Iterator<VWindow> rem = removedSubWindows.iterator(); rem
.hasNext();) {
final VWindow w = rem.next();
client.unregisterPaintable(w);
subWindows.remove(w);
w.hide();
}
if (uidl.hasAttribute("focused")) {
final String focusPid = uidl.getStringAttribute("focused");
// set focused component when render phase is finished
DeferredCommand.addCommand(new Command() {
public void execute() {
final Paintable toBeFocused = connection
.getPaintable(focusPid);
/*
* Two types of Widgets can be focused, either implementing
* GWT HasFocus of a thinner Vaadin specific Focusable