final Dimension box = DOM.getClientSize(getElement());
for (int i = 0, n = windowPanels.size(); i < n; i++) {
final WindowPanel w = windowPanels.get(i);
final Dimension d = WidgetHelper.getOffsetSize(w);
final Point p = getPopupPosition(w);
p.x -= Math.max(0, (p.x + w.getOffsetWidth()) - box.width);
p.y -= Math.max(0, (p.y + w.getOffsetHeight()) - box.height);
w.setPopupPosition(Math.max(0, p.x), Math.max(0, p.y));