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: jlabanca@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/2.1@8973 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/common.ant.xml b/common.ant.xml
index ad002f1..d688af8 100755
--- a/common.ant.xml
+++ b/common.ant.xml
@@ -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" />
diff --git a/distro-source/core/src/samples/build.xml b/distro-source/core/src/samples/build.xml
index 1ef868b..b8b4386 100644
--- a/distro-source/core/src/samples/build.xml
+++ b/distro-source/core/src/samples/build.xml
@@ -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>
diff --git a/samples/common.ant.xml b/samples/common.ant.xml
index 0152144..aa2939f 100755
--- a/samples/common.ant.xml
+++ b/samples/common.ant.xml
@@ -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}">
diff --git a/samples/dynatable/build.xml b/samples/dynatable/build.xml
index ddb6b09..d04532e 100755
--- a/samples/dynatable/build.xml
+++ b/samples/dynatable/build.xml
@@ -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>
diff --git a/samples/dynatablerf/build.xml b/samples/dynatablerf/build.xml
index ee78ce3..2848b88 100755
--- a/samples/dynatablerf/build.xml
+++ b/samples/dynatablerf/build.xml
@@ -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>
diff --git a/samples/expenses/build.xml b/samples/expenses/build.xml
index 0f624d9..9606721 100755
--- a/samples/expenses/build.xml
+++ b/samples/expenses/build.xml
@@ -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>
diff --git a/samples/hello/build.xml b/samples/hello/build.xml
index ff34e18..c9ee01f 100755
--- a/samples/hello/build.xml
+++ b/samples/hello/build.xml
@@ -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>
diff --git a/samples/json/build.xml b/samples/json/build.xml
index 1b9100f..a4e384a 100755
--- a/samples/json/build.xml
+++ b/samples/json/build.xml
@@ -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>
diff --git a/samples/logexample/build.xml b/samples/logexample/build.xml
index 2437018..070a1de 100755
--- a/samples/logexample/build.xml
+++ b/samples/logexample/build.xml
@@ -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>
diff --git a/samples/logexample/war/WEB-INF/web.xml b/samples/logexample/war/WEB-INF/web.xml
index 480d05e..7d448ab 100644
--- a/samples/logexample/war/WEB-INF/web.xml
+++ b/samples/logexample/war/WEB-INF/web.xml
@@ -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>
diff --git a/samples/mail/build.xml b/samples/mail/build.xml
index a211cb8..6c5e8da 100755
--- a/samples/mail/build.xml
+++ b/samples/mail/build.xml
@@ -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>
diff --git a/samples/showcase/build.xml b/samples/showcase/build.xml
index 60cb9b4..fde94a5 100755
--- a/samples/showcase/build.xml
+++ b/samples/showcase/build.xml
@@ -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>
diff --git a/samples/simplerpc/build.xml b/samples/simplerpc/build.xml
index 8dd550e..798f3cc 100644
--- a/samples/simplerpc/build.xml
+++ b/samples/simplerpc/build.xml
@@ -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>
diff --git a/samples/simplexml/build.xml b/samples/simplexml/build.xml
index 3c0b995..b1ae6b0 100755
--- a/samples/simplexml/build.xml
+++ b/samples/simplexml/build.xml
@@ -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>
diff --git a/samples/validation/build.xml b/samples/validation/build.xml
new file mode 100755
index 0000000..5f960a7
--- /dev/null
+++ b/samples/validation/build.xml
@@ -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>
diff --git a/servlet/build.xml b/servlet/build.xml
index 11aa99d..6440445 100755
--- a/servlet/build.xml
+++ b/servlet/build.xml
@@ -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>
diff --git a/user/src/com/google/gwt/user/client/ui/AbsolutePanel.java b/user/src/com/google/gwt/user/client/ui/AbsolutePanel.java
index b223e32..1f4da9f 100644
--- a/user/src/com/google/gwt/user/client/ui/AbsolutePanel.java
+++ b/user/src/com/google/gwt/user/client/ui/AbsolutePanel.java
@@ -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}'"));
}
}