summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/terminal/gwt
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-05-22 12:53:06 +0000
committerLeif Åstrand <leif@vaadin.com>2012-05-22 12:53:06 +0000
commite085efa41793fc68d455fa5d718bbfc1309296b9 (patch)
treea93aee6f8d9ed85f311544aeebf5b2ba01d2f084 /src/com/vaadin/terminal/gwt
parentbec62403a7b56f093f5ee9829fea20ba3dee4628 (diff)
downloadvaadin-framework-e085efa41793fc68d455fa5d718bbfc1309296b9.tar.gz
vaadin-framework-e085efa41793fc68d455fa5d718bbfc1309296b9.zip
Make browser window size available in Window (#5655)
svn changeset:23790/svn branch:6.8
Diffstat (limited to 'src/com/vaadin/terminal/gwt')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VView.java31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VView.java b/src/com/vaadin/terminal/gwt/client/ui/VView.java
index ec4c5d9cba..e544a56190 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VView.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VView.java
@@ -47,6 +47,10 @@ import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHan
public class VView extends SimplePanel implements Container, ResizeHandler,
Window.ClosingHandler, ShortcutActionHandlerOwner, Focusable {
+ public static final String BROWSER_HEIGHT_VAR = "browserHeight";
+
+ public static final String BROWSER_WIDTH_VAR = "browserWidth";
+
private static final String CLASSNAME = "v-view";
public static final String NOTIFICATION_HTML_CONTENT_NOT_ALLOWED = "useplain";
@@ -69,13 +73,6 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
private int windowWidth;
private int windowHeight;
- /*
- * Last know view size used to detect whether new dimensions should be sent
- * to the server.
- */
- private int viewWidth;
- private int viewHeight;
-
private ApplicationConnection connection;
/**
@@ -547,16 +544,18 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
*/
private void sendClientResized() {
Element parentElement = getElement().getParentElement();
- int newViewHeight = parentElement.getClientHeight();
- int newViewWidth = parentElement.getClientWidth();
+ int viewHeight = parentElement.getClientHeight();
+ int viewWidth = parentElement.getClientWidth();
- // Send the view dimensions if they have changed
- if (newViewHeight != viewHeight || newViewWidth != viewWidth) {
- viewHeight = newViewHeight;
- viewWidth = newViewWidth;
- connection.updateVariable(id, "height", newViewHeight, false);
- connection.updateVariable(id, "width", newViewWidth, immediate);
- }
+ connection.updateVariable(id, "height", viewHeight, false);
+ connection.updateVariable(id, "width", viewWidth, false);
+
+ int windowWidth = Window.getClientWidth();
+ int windowHeight = Window.getClientHeight();
+
+ connection.updateVariable(id, BROWSER_WIDTH_VAR, windowWidth, false);
+ connection.updateVariable(id, BROWSER_HEIGHT_VAR, windowHeight,
+ immediate);
}
public native static void goTo(String url)