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();
}
// Save currently open subwindows to track which will need to be closed
final HashSet<VWindow> removedSubWindows = new HashSet<VWindow>(
subWindows);
// Handle other UIDL children
while ((childUidl = uidl.getChildUIDL(++childIndex)) != null) {
String tag = childUidl.getTag().intern();
if (tag == "actions") {
if (actionHandler == null) {
actionHandler = new ShortcutActionHandler(id, client);
}
actionHandler.updateActionMap(childUidl);
} else if (tag == "execJS") {
String script = childUidl.getStringAttribute("script");
eval(script);
} else if (tag == "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);
}
} else {
// subwindows
final Paintable w = client.getPaintable(childUidl);
if (subWindows.contains(w)) {
removedSubWindows.remove(w);
} else {
subWindows.add((VWindow) w);
}
w.updateFromUIDL(childUidl, client);
}
}
// Close old windows which where not in UIDL anymore
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")) {
// set focused component when render phase is finished
DeferredCommand.addCommand(new Command() {
public void execute() {
final Paintable toBeFocused = uidl.getPaintableAttribute(
"focused", connection);
/*
* Two types of Widgets can be focused, either implementing
* GWT HasFocus of a thinner Vaadin specific Focusable