diff options
author | Artur Signell <artur@vaadin.com> | 2011-12-20 12:46:57 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2011-12-20 12:46:57 +0200 |
commit | 46903711e7e1f9f47eca6665242a40a891df8bce (patch) | |
tree | b2fa19acff7fbbb320e005cec67a05e852c163ed /src/com/vaadin/terminal/gwt/server/WebBrowser.java | |
parent | 51b6dc7aaa8aa6f8b428993658971a1a26d70b42 (diff) | |
parent | 67629854f920d734ceab541d8b27202ef04f6043 (diff) | |
download | vaadin-framework-46903711e7e1f9f47eca6665242a40a891df8bce.tar.gz vaadin-framework-46903711e7e1f9f47eca6665242a40a891df8bce.zip |
Merge remote-tracking branch 'origin/6.8'
Diffstat (limited to 'src/com/vaadin/terminal/gwt/server/WebBrowser.java')
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/WebBrowser.java | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/WebBrowser.java b/src/com/vaadin/terminal/gwt/server/WebBrowser.java index 8257bfae87..0a743fcf96 100644 --- a/src/com/vaadin/terminal/gwt/server/WebBrowser.java +++ b/src/com/vaadin/terminal/gwt/server/WebBrowser.java @@ -23,6 +23,8 @@ public class WebBrowser implements Terminal { private int screenHeight = 0; private int screenWidth = 0; + private int clientHeight = 0; + private int clientWidth = 0; private String browserApplication = null; private Locale locale; private String address; @@ -64,6 +66,24 @@ public class WebBrowser implements Terminal { } /** + * Gets the height of the client (browser window) + * + * @return The height of the client or 0 if unknown. + */ + public int getClientHeight() { + return clientHeight; + } + + /** + * Gets the width of the client (browser window) + * + * @return The width of the client or 0 if unknown. + */ + public int getClientWidth() { + return clientWidth; + } + + /** * Get the browser user-agent string. * * @return The raw browser userAgent string @@ -313,6 +333,10 @@ public class WebBrowser implements Terminal { * Screen width * @param sh * Screen height + * @param cw + * Client width + * @param ch + * Client height * @param tzo * TimeZone offset in minutes from GMT * @param rtzo @@ -325,9 +349,9 @@ public class WebBrowser implements Terminal { * the current date in milliseconds since the epoch * @param touchDevice */ - private void updateClientSideDetails(String sw, String sh, String tzo, - String rtzo, String dstSavings, String dstInEffect, String curDate, - boolean touchDevice) { + void updateClientSideDetails(String sw, String sh, String cw, String ch, + String tzo, String rtzo, String dstSavings, String dstInEffect, + String curDate, boolean touchDevice) { if (sw != null) { try { screenHeight = Integer.parseInt(sh); @@ -336,6 +360,14 @@ public class WebBrowser implements Terminal { screenHeight = screenWidth = 0; } } + if (cw != null) { + try { + clientHeight = Integer.parseInt(ch); + clientWidth = Integer.parseInt(cw); + } catch (final NumberFormatException e) { + clientHeight = clientWidth = 0; + } + } if (tzo != null) { try { // browser->java conversion: min->ms, reverse sign @@ -396,7 +428,8 @@ public class WebBrowser implements Terminal { if (request.getParameter("sw") != null) { updateClientSideDetails(request.getParameter("sw"), - request.getParameter("sh"), request.getParameter("tzo"), + request.getParameter("sh"), request.getParameter("cw"), + request.getParameter("ch"), request.getParameter("tzo"), request.getParameter("rtzo"), request.getParameter("dstd"), request.getParameter("dston"), request.getParameter("curdate"), |