setPopupPosition(positionx, positiony);
}
boolean showingUrl = false;
int childIndex = 0;
UIDL childUidl = uidl.getChildUIDL(childIndex++);
while ("open".equals(childUidl.getTag())) {
// TODO multiple opens with the same target will in practice just
// open the last one - should we fix that somehow?
final String parsedUri = client.translateVaadinUri(childUidl
.getStringAttribute("src"));
if (!childUidl.hasAttribute("name")) {
final Frame frame = new Frame();
DOM.setStyleAttribute(frame.getElement(), "width", "100%");
DOM.setStyleAttribute(frame.getElement(), "height", "100%");
DOM.setStyleAttribute(frame.getElement(), "border", "0px");
frame.setUrl(parsedUri);
contentPanel.setWidget(frame);
showingUrl = true;
} else {
final String target = childUidl.getStringAttribute("name");
Window.open(parsedUri, target, "");
}
childUidl = uidl.getChildUIDL(childIndex++);
}
final Paintable lo = client.getPaintable(childUidl);
if (layout != null) {
if (layout != lo) {
// remove old
client.unregisterPaintable(layout);
contentPanel.remove((Widget) layout);
// add new
if (!showingUrl) {
contentPanel.setWidget((Widget) lo);
}
layout = lo;
}
} else if (!showingUrl) {
contentPanel.setWidget((Widget) lo);
layout = lo;
}
dynamicWidth = !uidl.hasAttribute("width");
dynamicHeight = !uidl.hasAttribute("height");
layoutRelativeWidth = uidl.hasAttribute("layoutRelativeWidth");
layoutRelativeHeight = uidl.hasAttribute("layoutRelativeHeight");
if (dynamicWidth && layoutRelativeWidth) {
/*
* Relative layout width, fix window width before rendering (width
* according to caption)
*/
setNaturalWidth();
}
layout.updateFromUIDL(childUidl, client);
if (!dynamicHeight && layoutRelativeWidth) {
/*
* Relative layout width, and fixed height. Must update the size to
* be able to take scrollbars into account (layout gets narrower
* space if it is higher than the window) -> only vertical scrollbar
*/
client.runDescendentsLayout(this);
}
/*
* No explicit width is set and the layout does not have relative width
* so fix the size according to the layout.
*/
if (dynamicWidth && !layoutRelativeWidth) {
setNaturalWidth();
}
if (dynamicHeight && layoutRelativeHeight) {
// Prevent resizing until height has been fixed
resizable = false;
}
// we may have actions and notifications
if (uidl.getChildCount() > 1) {
final int cnt = uidl.getChildCount();
for (int i = 1; i < cnt; i++) {
childUidl = uidl.getChildUIDL(i);
if (childUidl.getTag().equals("actions")) {
if (shortcutHandler == null) {
shortcutHandler = new ShortcutActionHandler(id, client);
}
shortcutHandler.updateActionMap(childUidl);
} else if (childUidl.getTag().equals("notifications")) {
for (final Iterator<?> it = childUidl.getChildIterator(); it
.hasNext();) {
final UIDL notification = (UIDL) it.next();
VNotification.showNotification(client, notification);
}
}
}