Revision: 8973
Author: p...@google.com
Date: Thu Oct  7 11:13:29 2010
Log: Cherry picking changes from trunk to GWT 2.1.0-rc1
* Correcting the servlet URL mapping in the LogExample sample.
* Fix verifyPositionStatic() so that RootPanel.get() is explicitly allowed, e.g., RootPanel.get().add(widget, x, y), by whitelisting a BODY parent element. * Also, only perform parent==offsetParent test when both parent and child widgets are visible and attached to the DOM. * Use a seperate sample.extraclasspath so each sample can specify their own jars.
* Fixes LogExample and DynaTableRf for distro builds.

Review by: jlaba...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=8973

Added:
 /releases/2.1/samples/validation
 /releases/2.1/samples/validation/build.xml
Modified:
 /releases/2.1/common.ant.xml
 /releases/2.1/distro-source/core/src/samples/build.xml
 /releases/2.1/samples/common.ant.xml
 /releases/2.1/samples/dynatable/build.xml
 /releases/2.1/samples/dynatablerf/build.xml
 /releases/2.1/samples/expenses/build.xml
 /releases/2.1/samples/hello/build.xml
 /releases/2.1/samples/json/build.xml
 /releases/2.1/samples/logexample/build.xml
 /releases/2.1/samples/logexample/war/WEB-INF/web.xml
 /releases/2.1/samples/mail/build.xml
 /releases/2.1/samples/showcase/build.xml
 /releases/2.1/samples/simplerpc/build.xml
 /releases/2.1/samples/simplexml/build.xml
 /releases/2.1/servlet/build.xml
 /releases/2.1/user/src/com/google/gwt/user/client/ui/AbsolutePanel.java

=======================================
--- /dev/null
+++ /releases/2.1/samples/validation/build.xml  Thu Oct  7 11:13:29 2010
@@ -0,0 +1,28 @@
+<project name="validation" default="build" basedir=".">
+  <property name="sample.root" value="validation" />
+  <property name="sample.module" value="Validation" />
+  <property name="sample.path" value="src" />
+  <import file="../common.ant.xml" />
+
+  <!-- these are after the common.ant.xml so they have gwt.tools etc. -->
+  <path id="sample.extraclasspath">
+ <pathelement location="${gwt.tools.lib}/apache/log4j/log4j-1.2.16.jar" /> + <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" /> + <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA-sources.jar" /> + <pathelement location="${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final.jar" /> + <pathelement location="${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final-sources.jar" /> + <pathelement location="${gwt.tools.lib}/slf4j/slf4j-api/slf4j-api-1.6.1.jar" /> + <pathelement location="${gwt.tools.lib}/slf4j/slf4j-log4j12/slf4j-log4j12-1.6.1.jar" />
+    <!-- Needed for JDK 1.5-->
+ <pathelement location="${gwt.tools.lib}/javax/activation/activation-1.1.jar" /> + <pathelement location="${gwt.tools.lib}/javax/xml/bind/jaxb-api-2.1.jar" /> + <pathelement location="${gwt.tools.lib}/sun/jaxb/jaxb-impl-2.1.3.jar" /> + <pathelement location="${gwt.tools.lib}/javax/xml/stream/stax-api-1.0-2.jar" />
+  </path>
+  <fileset id="sample.server.libs" dir="${gwt.tools.lib}">
+ <include name="hibernate/validator/hibernate-validator-4.1.0.Final.jar" />
+    <include name="apache/log4j/log4j-1.2.16.jar" />
+    <include name="slf4j/slf4j-api/slf4j-api-1.6.1.jar" />
+    <include name="slf4j/slf4j-log4j12/slf4j-log4j12-1.6.1.jar" />
+  </fileset>
+</project>
=======================================
--- /releases/2.1/common.ant.xml        Wed Sep  8 15:25:08 2010
+++ /releases/2.1/common.ant.xml        Thu Oct  7 11:13:29 2010
@@ -96,7 +96,16 @@
     <isset property="build.host.iswindows" />
   </condition>
<fail unless="build.host.platform" message="Building on ${os.name} is not supported" />
-
+
+  <!-- JVM -->
+  <condition property="build.jvm.is15">
+     <equals arg1="${ant.java.version}" arg2="1.5"/>
+  </condition>
+
+  <condition property="build.jvm.is16">
+     <equals arg1="${ant.java.version}" arg2="1.6"/>
+  </condition>
+
   <!-- JUnit support -->
<property name="gwt.dev.staging.jar" location="${gwt.build.staging}/gwt-${gwt.version}/gwt-dev.jar" />
   <property name="gwt.junit.port" value="8888" />
=======================================
--- /releases/2.1/distro-source/core/src/samples/build.xml Tue Nov 10 10:02:42 2009 +++ /releases/2.1/distro-source/core/src/samples/build.xml Thu Oct 7 11:13:29 2010
@@ -2,8 +2,10 @@

   <target name="-do">
     <ant target="${target}" dir="DynaTable"/>
+    <ant target="${target}" dir="DynaTableRf"/>
     <ant target="${target}" dir="Hello"/>
     <ant target="${target}" dir="JSON"/>
+    <ant target="${target}" dir="LogExample"/>
     <ant target="${target}" dir="Mail"/>
     <ant target="${target}" dir="Showcase"/>
   </target>
=======================================
--- /releases/2.1/samples/common.ant.xml        Fri Aug 27 07:47:27 2010
+++ /releases/2.1/samples/common.ant.xml        Thu Oct  7 11:13:29 2010
@@ -28,6 +28,11 @@
<pathelement location="${gwt.tools.lib}/appengine/datanucleus-appengine-1.0.7.final.jar"/>
   </path>

+ <!-- The libraries required by the server that will be copied into WEB-INF/lib. -->
+  <fileset id="sample.server.libs" dir="${gwt.tools.lib}">
+    <include name="" />
+  </fileset>
+
   <target name="source" description="Copy source to the output folder">
     <mkdir dir="${sample.build}/src" />
     <copy todir="${sample.build}/src">
@@ -57,14 +62,20 @@
     </if>
   </target>

+ <target name="serverlibs" description="Copy server libs to the output folder">
+    <mkdir dir="${sample.build}/war/WEB-INF/lib" />
+    <copy todir="${sample.build}/war/WEB-INF/lib/" flatten="true">
+      <fileset refid="sample.server.libs" />
+    </copy>
+  </target>
+
   <target name="compile" description="Compile all java files">
     <mkdir dir="${sample.build}/war/WEB-INF/classes" />
     <gwt.javac destdir="${sample.build}/war/WEB-INF/classes">
       <classpath>
         <pathelement location="${gwt.user.jar}" />
         <pathelement location="${gwt.dev.jar}" />
- <pathelement location="${gwt.tools.lib}/jsr107cache/jsr107cache-1.1.jar"/> - <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar"/>
+        <path refid="sample.extraclasspath" />
         <path refid="gae.extraclasspath" />
       </classpath>
     </gwt.javac>
@@ -77,15 +88,22 @@
         <fileset dir="${sample.build}/war/WEB-INF/classes" />
         <fileset file="${gwt.user.jar}" />
         <fileset file="${gwt.dev.jar}" />
+        <path refid="sample.extraclasspath" />
       </sourcefiles>
<targetfiles path="${sample.build}/war/${sample.lower}/${sample.lower}.nocache.js" />
       <sequential>
         <mkdir dir="${sample.build}/war" />
<gwt.timer name="${sample.upper} with ${gwt.samples.localworkers} localWorkers"> <java dir="${sample.build}" classname="com.google.gwt.dev.Compiler" - classpath="${sample.path}:${sample.build}/war/WEB-INF/classes:${gwt.user.jar}:${gwt.dev.jar}:${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar:${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA-sources.jar"
-               fork="yes" failonerror="true">
-            <jvmarg value="-Xmx256M"/>
+                               fork="yes" failonerror="true">
+            <classpath>
+              <pathelement path="${sample.path}" />
+              <path refid="sample.extraclasspath" />
+ <pathelement location="${sample.build}/war/WEB-INF/classes" />
+              <pathelement location="${gwt.user.jar}" />
+              <pathelement location="${gwt.dev.jar}" />
+            </classpath>
+            <jvmarg value="-Xmx256M" />
             <arg value="-localWorkers" />
             <arg value="${gwt.samples.localworkers}" />
             <arg value="-war" />
@@ -132,7 +150,7 @@
     <webAppCreator platform="mac" />
   </target>

- <target name="build" depends="source, compile, gwtc, scripts" description="Build and package this project" /> + <target name="build" depends="source, serverlibs, compile, gwtc, scripts" description="Build and package this project" />

   <target name="checkstyle" description="Static analysis of source">
     <gwt.checkstyle outputdirectory="${sample.build}">
=======================================
--- /releases/2.1/samples/dynatable/build.xml   Wed Aug 18 18:29:03 2010
+++ /releases/2.1/samples/dynatable/build.xml   Thu Oct  7 11:13:29 2010
@@ -3,4 +3,8 @@
   <property name="sample.module" value="DynaTable" />
   <property name="sample.path" value="src" />
   <import file="../common.ant.xml" />
+  <!-- these are after the common.ant.xml so they have gwt.tools etc -->
+  <path id="sample.extraclasspath">
+ <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" />
+  </path>
 </project>
=======================================
--- /releases/2.1/samples/dynatablerf/build.xml Wed Aug 18 18:29:03 2010
+++ /releases/2.1/samples/dynatablerf/build.xml Thu Oct  7 11:13:29 2010
@@ -3,4 +3,15 @@
   <property name="sample.module" value="DynaTableRf" />
   <property name="sample.path" value="src" />
   <import file="../common.ant.xml" />
+  <!-- these are after the common.ant.xml so they have gwt.tools etc -->
+  <path id="sample.extraclasspath">
+ <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" /> + <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA-sources.jar" />
+  </path>
+  <fileset id="sample.server.libs" dir="${gwt.tools.lib}">
+ <include name="hibernate/validator/hibernate-validator-4.1.0.Final.jar" />
+    <include name="apache/log4j/log4j-1.2.16.jar" />
+    <include name="slf4j/slf4j-api/slf4j-api-1.6.1.jar" />
+    <include name="slf4j/slf4j-log4j12/slf4j-log4j12-1.6.1.jar" />
+  </fileset>
 </project>
=======================================
--- /releases/2.1/samples/expenses/build.xml    Wed Aug 18 18:29:03 2010
+++ /releases/2.1/samples/expenses/build.xml    Thu Oct  7 11:13:29 2010
@@ -3,4 +3,7 @@
   <property name="sample.module" value="Expenses" />
   <property name="sample.path" value="src/main/java" />
   <import file="../common.ant.xml" />
+  <!-- these are after the common.ant.xml so they have gwt.tools... -->
+  <path id="sample.extraclasspath">
+  </path>
 </project>
=======================================
--- /releases/2.1/samples/hello/build.xml       Wed Aug 18 18:29:03 2010
+++ /releases/2.1/samples/hello/build.xml       Thu Oct  7 11:13:29 2010
@@ -3,4 +3,7 @@
   <property name="sample.module" value="Hello" />
   <property name="sample.path" value="src" />
   <import file="../common.ant.xml" />
+  <!-- these are after the common.ant.xml so they have gwt.tools... -->
+  <path id="sample.extraclasspath">
+  </path>
 </project>
=======================================
--- /releases/2.1/samples/json/build.xml        Wed Aug 18 18:29:03 2010
+++ /releases/2.1/samples/json/build.xml        Thu Oct  7 11:13:29 2010
@@ -3,4 +3,7 @@
   <property name="sample.module" value="JSON" />
   <property name="sample.path" value="src" />
   <import file="../common.ant.xml" />
+  <!-- these are after the common.ant.xml so they have gwt.tools... -->
+  <path id="sample.extraclasspath">
+  </path>
 </project>
=======================================
--- /releases/2.1/samples/logexample/build.xml  Wed Aug 18 18:29:03 2010
+++ /releases/2.1/samples/logexample/build.xml  Thu Oct  7 11:13:29 2010
@@ -3,4 +3,7 @@
   <property name="sample.module" value="LogExample" />
   <property name="sample.path" value="src" />
   <import file="../common.ant.xml" />
+  <!-- these are after the common.ant.xml so they have gwt.tools... -->
+  <path id="sample.extraclasspath">
+  </path>
 </project>
=======================================
--- /releases/2.1/samples/logexample/war/WEB-INF/web.xml Mon Sep 13 08:42:16 2010 +++ /releases/2.1/samples/logexample/war/WEB-INF/web.xml Thu Oct 7 11:13:29 2010
@@ -9,7 +9,7 @@

   <servlet-mapping>
     <servlet-name>myServlet</servlet-name>
-    <url-pattern>/logexample/log</url-pattern>
+    <url-pattern>logexample/my_service</url-pattern>
   </servlet-mapping>

   <servlet>
=======================================
--- /releases/2.1/samples/mail/build.xml        Wed Aug 18 18:29:03 2010
+++ /releases/2.1/samples/mail/build.xml        Thu Oct  7 11:13:29 2010
@@ -3,4 +3,7 @@
   <property name="sample.module" value="Mail" />
   <property name="sample.path" value="src" />
   <import file="../common.ant.xml" />
+  <!-- these are after the common.ant.xml so they have gwt.tools... -->
+  <path id="sample.extraclasspath">
+  </path>
 </project>
=======================================
--- /releases/2.1/samples/showcase/build.xml    Wed Aug 18 18:29:03 2010
+++ /releases/2.1/samples/showcase/build.xml    Thu Oct  7 11:13:29 2010
@@ -3,4 +3,7 @@
   <property name="sample.module" value="Showcase" />
   <property name="sample.path" value="src" />
   <import file="../common.ant.xml" />
+  <!-- these are after the common.ant.xml so they have gwt.tools... -->
+  <path id="sample.extraclasspath">
+  </path>
 </project>
=======================================
--- /releases/2.1/samples/simplerpc/build.xml   Wed Aug 18 18:29:03 2010
+++ /releases/2.1/samples/simplerpc/build.xml   Thu Oct  7 11:13:29 2010
@@ -3,4 +3,7 @@
   <property name="sample.module" value="SimpleRPC" />
   <property name="sample.path" value="src" />
   <import file="../common.ant.xml" />
+  <!-- these are after the common.ant.xml so they have gwt.tools... -->
+  <path id="sample.extraclasspath">
+  </path>
 </project>
=======================================
--- /releases/2.1/samples/simplexml/build.xml   Wed Aug 18 18:29:03 2010
+++ /releases/2.1/samples/simplexml/build.xml   Thu Oct  7 11:13:29 2010
@@ -3,4 +3,7 @@
   <property name="sample.module" value="SimpleXML" />
   <property name="sample.path" value="src" />
   <import file="../common.ant.xml" />
+  <!-- these are after the common.ant.xml so they have gwt.tools... -->
+  <path id="sample.extraclasspath">
+  </path>
 </project>
=======================================
--- /releases/2.1/servlet/build.xml     Mon Feb  1 08:08:26 2010
+++ /releases/2.1/servlet/build.xml     Thu Oct  7 11:13:29 2010
@@ -21,6 +21,9 @@
         <exclude name="com/google/gwt/junit/server/**" />
         <exclude name="com/google/gwt/benchmarks/*" />
       </fileset>
+      <!-- The following two jars satisfy RequestFactory dependencies. -->
+ <zipfileset src="${gwt.tools.redist}/json/r2_20080312/json-1.5.jar" /> + <zipfileset src="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" />
     </gwt.jar>
   </target>

=======================================
--- /releases/2.1/user/src/com/google/gwt/user/client/ui/AbsolutePanel.java Mon Sep 13 10:28:49 2010 +++ /releases/2.1/user/src/com/google/gwt/user/client/ui/AbsolutePanel.java Thu Oct 7 11:13:29 2010
@@ -227,19 +227,56 @@
     }
   }

-  private void verifyPositionNotStatic(Widget w) {
-    if (!GWT.isProdMode()) {
-      if (w.getElement().getOffsetParent() != getElement()) {
-        String className = getClass().getName();
- GWT.log("Warning: " + className + " descendants will be incorrectly " - + "positioned, i.e. not relative to their parent element, when " - + "'position:static', which is the CSS default, is in effect. One "
-            + "possible fix is to call "
- + "'panel.getElement().getStyle().setPosition(Position.RELATIVE)'.",
-            // Stack trace provides context for the developer
-            new IllegalStateException(className
-                + " is missing CSS 'position:{relative,absolute,fixed}'"));
-      }
-    }
+  /**
+ * Verify that the given widget is not statically positioned on the page, i.e.
+   * relative to the document window, unless the widget is in fact directly
+ * attached to the document BODY. Note that the current use of this method is + * not comprehensive, since we can only verify the offsetParent if both parent + * (AbsolutePanel) and child widget are both visible and attached to the DOM
+   * when this test is executed.
+   *
+   * @param child the widget whose position and placement should be tested
+   */
+  private void verifyPositionNotStatic(Widget child) {
+    // Only verify widget position in Development Mode
+    if (GWT.isProdMode()) {
+      return;
+    }
+
+    // Non-visible or detached elements have no offsetParent
+    if (child.getElement().getOffsetParent() == null) {
+      return;
+    }
+
+    // Check if offsetParent == parent
+    if (child.getElement().getOffsetParent() == getElement()) {
+      return;
+    }
+
+    /*
+ * When this AbsolutePanel is the document BODY, e.g. RootPanel.get(), then
+     * no explicit position:relative is needed as children are already
+     * positioned relative to their parent. For simplicity we test against
+ * parent, not offsetParent, since in IE6+IE7 (but not IE8+) standards mode, + * the offsetParent, for elements whose parent is the document BODY, is the
+     * HTML element, not the BODY element.
+     */
+    if ("body".equals(getElement().getNodeName().toLowerCase())) {
+      return;
+    }
+
+    /*
+ * Warn the developer, but allow the execution to continue in case legacy
+     * apps depend on broken CSS.
+     */
+    String className = getClass().getName();
+    GWT.log("Warning: " + className + " descendants will be incorrectly "
+        + "positioned, i.e. not relative to their parent element, when "
+        + "'position:static', which is the CSS default, is in effect. One "
+        + "possible fix is to call "
+ + "'panel.getElement().getStyle().setPosition(Position.RELATIVE)'.",
+        // Stack trace provides context for the developer
+        new IllegalStateException(className
+            + " is missing CSS 'position:{relative,absolute,fixed}'"));
   }
 }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to