diff options
author | Automerge <automerge@vaadin.com> | 2012-03-06 10:06:12 +0000 |
---|---|---|
committer | Automerge <automerge@vaadin.com> | 2012-03-06 10:06:12 +0000 |
commit | 630410e7a15cc948ae13519e279678a1085081a5 (patch) | |
tree | 50d832bd1fe884dfa9aade9f43384cdb66f21347 /src | |
parent | 0b46687ab0cedb3523321854b52d988dae18452a (diff) | |
download | vaadin-framework-630410e7a15cc948ae13519e279678a1085081a5.tar.gz vaadin-framework-630410e7a15cc948ae13519e279678a1085081a5.zip |
[merge from 6.7] #3401 Resizing browser window should ensure sub windows are visible
svn changeset:23185/svn branch:6.8
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VView.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VView.java b/src/com/vaadin/terminal/gwt/client/ui/VView.java index 07ade6a8b1..46a7df9efb 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VView.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VView.java @@ -149,10 +149,46 @@ public class VView extends SimplePanel implements Container, ResizeHandler, connection.runDescendentsLayout(VView.this); Util.runWebkitOverflowAutoFix(getElement()); + ensureSubWindowsVisible(); sendClientResized(); } } + private void ensureSubWindowsVisible() { + for (VWindow subWindow : subWindows) { + int oldLeft = subWindow.getPopupLeft(); + int oldWidth = subWindow.getOffsetWidth(); + int oldRight = oldLeft + oldWidth; + + int newLeft = oldLeft; + + if (oldRight > width) { + newLeft = width - oldWidth; + if (newLeft < 0) { + newLeft = 0; + subWindow.setWidth(width + "px"); + } + } + + int oldTop = subWindow.getPopupTop(); + int oldHeight = subWindow.getOffsetHeight(); + int oldBottom = oldTop + oldHeight; + + int newTop = oldTop; + + if (oldBottom > height) { + newTop = height - oldHeight; + if (newTop < 0) { + newTop = 0; + subWindow.setHeight(height + "px"); + } + } + + subWindow.setPopupPosition(newLeft, newTop); + } + + } + public String getTheme() { return theme; } |