// Open URL:s
boolean isClosed = false; // was this window closed?
while (childIndex < uidl.getChildCount()
&& "open".equals(uidl.getChildUIDL(childIndex).getTag())) {
final UIDL open = uidl.getChildUIDL(childIndex);
final String url = client.translateVaadinUri(open
.getStringAttribute("src"));
final String target = open.getStringAttribute("name");
if (target == null) {
// source will be opened to this browser window, but we may have
// to finish rendering this window in case this is a download
// (and window stays open).
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
goTo(url);
}
});
} else if ("_self".equals(target)) {
// This window is closing (for sure). Only other opens are
// relevant in this change. See #3558, #2144
isClosed = true;
goTo(url);
} else {
String options;
if (open.hasAttribute("border")) {
if (open.getStringAttribute("border").equals("minimal")) {
options = "menubar=yes,location=no,status=no";
} else {
options = "menubar=no,location=no,status=no";
}
} else {
options = "resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes";
}
if (open.hasAttribute("width")) {
int w = open.getIntAttribute("width");
options += ",width=" + w;
}
if (open.hasAttribute("height")) {
int h = open.getIntAttribute("height");
options += ",height=" + h;
}
Window.open(url, target, options);
}
childIndex++;
}
if (isClosed) {
// don't render the content, something else will be opened to this
// browser view
rendering = false;
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();
VNotification.showNotification(client, notification);
}
} else {
// subwindows
final Paintable w = client.getPaintable(childUidl);