Revision: 7012 Author: [email protected] Date: Wed Nov 18 15:11:38 2009 Log: tr...@7007,7008,7010 was merged into this branch Adds Window.Navigator API Removes hosted mode reference in DynaTable svn merge --ignore-ancestry -c7007,7008,7010 https://google-web-toolkit.googlecode.com/svn/trunk .
Patch by: jlabanca http://code.google.com/p/google-web-toolkit/source/detail?r=7012 Modified: /releases/2.0/branch-info.txt /releases/2.0/samples/dynatable/src/com/google/gwt/sample/dynatable/client/DynaTableWidget.java /releases/2.0/user/src/com/google/gwt/user/client/Window.java /releases/2.0/user/test/com/google/gwt/user/client/WindowTest.java ======================================= --- /releases/2.0/branch-info.txt Wed Nov 18 15:09:17 2009 +++ /releases/2.0/branch-info.txt Wed Nov 18 15:11:38 2009 @@ -797,3 +797,8 @@ tr...@7009 was merged into this branch Sorts set/getCodeServerPort properly svn merge --ignore-ancestry -c7009 https://google-web-toolkit.googlecode.com/svn/trunk . + +tr...@7007,7008,7010 was merged into this branch + Adds Window.Navigator API + Removes hosted mode reference in DynaTable + svn merge --ignore-ancestry -c7007,7008,7010 https://google-web-toolkit.googlecode.com/svn/trunk . ======================================= --- /releases/2.0/samples/dynatable/src/com/google/gwt/sample/dynatable/client/DynaTableWidget.java Thu Nov 20 14:17:44 2008 +++ /releases/2.0/samples/dynatable/src/com/google/gwt/sample/dynatable/client/DynaTableWidget.java Wed Nov 18 15:11:38 2009 @@ -176,7 +176,7 @@ + "successfully return data, the server component must be available.</p>" + "<p>If you are running this demo from compiled code, the server " + "component may not be available to respond to the RPC requests from " - + "DynaTable. Try running DynaTable in hosted mode to see the demo " + + "DynaTable. Try running DynaTable in development mode to see the demo " + "in action.</p> " + "<p>Click on the Remote Procedure Call link above for more information " + "on GWT's RPC infrastructure."; ======================================= --- /releases/2.0/user/src/com/google/gwt/user/client/Window.java Fri Oct 16 14:48:33 2009 +++ /releases/2.0/user/src/com/google/gwt/user/client/Window.java Wed Nov 18 15:11:38 2009 @@ -337,6 +337,78 @@ private Location() { } } + + /** + * This class provides access to the browser's navigator object. The mimeTypes + * and plugins properties are not included. + */ + public static class Navigator { + /** + * Gets the navigator.appCodeName. + * + * @return the window's navigator.appCodeName. + */ + public static native String getAppCodeName() /*-{ + return $wnd.navigator.appCodeName; + }-*/; + + /** + * Gets the navigator.appName. + * + * @return the window's navigator.appName. + */ + public static native String getAppName() /*-{ + return $wnd.navigator.appName; + }-*/; + + /** + * Gets the navigator.appVersion. + * + * @return the window's navigator.appVersion. + */ + public static native String getAppVersion() /*-{ + return $wnd.navigator.appVersion; + }-*/; + + /** + * Gets the navigator.platform. + * + * @return the window's navigator.platform. + */ + public static native String getPlatform() /*-{ + return $wnd.navigator.platform; + }-*/; + + /** + * Gets the navigator.userAgent. + * + * @return the window's navigator.userAgent. + */ + public static native String getUserAgent() /*-{ + return $wnd.navigator.userAgent; + }-*/; + + /** + * Gets the navigator.cookieEnabled. + * + * @return the window's navigator.cookieEnabled. + */ + public static native boolean isCookieEnabled() /*-{ + return $wnd.navigator.cookieEnabled; + }-*/; + + /** + * Tests whether Java is enabled in the current browser. + * + * @return the window's navigator.javaEnabled. + */ + public static native boolean isJavaEnabled() /*-{ + return $wnd.navigator.javaEnabled(); + }-*/; + + private Navigator() { + } + } /** * Fired when the browser window is scrolled. ======================================= --- /releases/2.0/user/test/com/google/gwt/user/client/WindowTest.java Wed Oct 28 19:23:32 2009 +++ /releases/2.0/user/test/com/google/gwt/user/client/WindowTest.java Wed Nov 18 15:11:38 2009 @@ -15,12 +15,14 @@ */ package com.google.gwt.user.client; +import com.google.gwt.core.client.JavaScriptException; import com.google.gwt.event.logical.shared.ResizeEvent; import com.google.gwt.http.client.UrlBuilder; import com.google.gwt.junit.DoNotRunWith; import com.google.gwt.junit.Platform; import com.google.gwt.junit.client.GWTTestCase; import com.google.gwt.user.client.Window.Location; +import com.google.gwt.user.client.Window.Navigator; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.RootPanel; @@ -29,7 +31,7 @@ import java.util.Map; /** - * Test Case for {...@link Cookies}. + * Test Case for {...@link Window}. */ public class WindowTest extends GWTTestCase { @@ -164,6 +166,23 @@ map = Window.Location.buildListParamMap("?foo=bar%20baz%3aqux"); assertEquals(map.get("foo").get(0), "bar baz:qux"); } + + public void testNavigator() { + assertNotNull(Navigator.getAppCodeName()); + assertNotNull(Navigator.getAppName()); + assertNotNull(Navigator.getAppVersion()); + assertNotNull(Navigator.getPlatform()); + assertNotNull(Navigator.getUserAgent()); + assertTrue(Navigator.isCookieEnabled()); + // We don't care if Java is enabled, but need to make sure this call does + // not throw. The try/catch block keeps the compiled code from being + // optimized away. + try { + Navigator.isJavaEnabled(); + } catch (JavaScriptException e) { + throw e; + } + } /** * Tests the ability of the Window to get the client size correctly with and @@ -183,6 +202,12 @@ assertTrue("Expect positive oldClientHeight. " + "This will fail in WebKit if run headless", oldClientHeight > 0); assertTrue(oldClientWidth > 0); + + // Firefox hides scrollbar if clientHeight < 49 even when it should show. + // If we are in this case, simply return. + if (oldClientHeight < 49 && Navigator.getUserAgent().contains("Firefox")) { + return; + } // Compare to the dimensions with scroll bars Window.enableScrolling(true); -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
