Changes in samples build scripts

- Adding devmode task to all ant samples with the option to run
  the classic model adding gwt.args=-nosuperDevMode
- Detect whether the example is a maven build, and notice
  the user about it.
- Upgrade mobilewebapp gae version

Change-Id: I4061ea6d2d699bcb8ab437f1b60e3ff0c08cd3f2
diff --git a/samples/build.xml b/samples/build.xml
index 36d6703..1511036 100644
--- a/samples/build.xml
+++ b/samples/build.xml
@@ -11,7 +11,7 @@
   </target>
 
   <target name="dynatablerf" description="Build dynatablerf">
-    <gwt.ant dir="dynatablerf" target="source" />
+    <gwt.ant dir="dynatablerf" />
   </target>
 
   <target name="hello" description="Build hello">
@@ -27,7 +27,7 @@
   </target>
 
   <target name="mobilewebapp" description="Build mobile web app">
-    <gwt.ant dir="mobilewebapp" target="source" />
+    <gwt.ant dir="mobilewebapp" />
   </target>
 
   <target name="showcase" description="Build showcase">
@@ -35,7 +35,7 @@
   </target>
 
   <target name="validation" description="Build validation">
-    <gwt.ant dir="validation" target="source" />
+    <gwt.ant dir="validation" />
   </target>
 
   <target name="validationtck" description="Build validation TCK">
diff --git a/samples/common.ant.xml b/samples/common.ant.xml
index 8335549..e9d8e7d 100755
--- a/samples/common.ant.xml
+++ b/samples/common.ant.xml
@@ -14,9 +14,23 @@
   <property name="sample.lower" value="${sample.root}" />
   <property name="sample.upper" value="${sample.module}" />
 
+  <property name="gwt.args" value="" />
+
   <property.ensure name="gwt.user.jar" location="${gwt.build.lib}/gwt-user.jar" />
   <property.ensure name="gwt.dev.jar" location="${gwt.build.lib}/gwt-dev.jar" />
   <property.ensure name="gwt.codeserver.jar" location="${gwt.build.lib}/gwt-codeserver.jar" />
+  <condition property="type.maven">
+    <available file="pom.xml" />
+  </condition>
+
+  <!-- In maven projects show a message indicating how to build the project using 'mvn' -->
+  <target name="check.build.type" if="type.maven">
+    <echo>
+        ${sample.upper} is a maven project.
+         - use 'mvn clean package' to build it.
+         - or use 'mvn gwt:run' to run it in dev mode.
+    </echo>
+  </target>
 
   <!-- Mirror directory for scripts; makes building distro easier -->
   <property name="samples.scripts" value="${gwt.build.out}/samples-scripts" />
@@ -34,7 +48,7 @@
     <include name="" />
   </fileset>
 
-  <target name="source" description="Copy source to the output folder">
+  <target name="source" depends="check.build.type" description="Copy source to the output folder">
     <mkdir dir="${sample.build}/src" />
     <copy todir="${sample.build}/src">
       <fileset dir="src" />
@@ -94,14 +108,14 @@
     </if>
   </target>
 
-  <target name="serverlibs" description="Copy server libs to the output folder">
+  <target name="serverlibs" unless="type.maven" 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">
+  <target name="compile" unless="type.maven" description="Compile all java files">
     <mkdir dir="${sample.build}/war/WEB-INF/classes" />
     <gwt.javac destdir="${sample.build}/war/WEB-INF/classes"
                excludes="**/super/**">
@@ -109,12 +123,11 @@
         <pathelement location="${gwt.user.jar}" />
         <pathelement location="${gwt.dev.jar}" />
         <path refid="sample.extraclasspath" />
-        <path refid="gae.extraclasspath" />
       </classpath>
     </gwt.javac>
   </target>
 
-  <target name="gwtc" description="Compile to JavaScript">
+  <target name="gwtc" unless="type.maven" description="Compile to JavaScript">
     <outofdate>
       <sourcefiles>
         <fileset dir="${sample.path}" />
@@ -134,8 +147,6 @@
             <pathelement location="${sample.build}/war/WEB-INF/classes" />
             <pathelement location="${gwt.user.jar}" />
             <pathelement location="${gwt.dev.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" />
           </classpath>
           <jvmarg value="-Xmx384M" />
           <arg value="-localWorkers" />
@@ -177,7 +188,7 @@
     </sequential>
   </macrodef>
 
-  <target name="scripts" description="Create launch scripts">
+  <target name="scripts" unless="type.maven" description="Create launch scripts">
     <webAppCreator platform="linux" />
     <webAppCreator platform="windows" extension=".cmd" />
     <webAppCreator platform="mac" />
@@ -202,4 +213,23 @@
       </fileset>
     </delete>
   </target>
+
+  <target name="devmode" depends="source, compile" unless="type.maven"
+    description="Run Super Dev Mode (pass -Dgwt.args=-nosuperDevMode to fallback to classic DevMode)">
+    <property name="sample.package" value="com.google.gwt.sample.${sample.root}" />
+    <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
+      <classpath>
+        <pathelement location="${sample.path}"/>
+        <pathelement location="${gwt.user.jar}"/>
+        <pathelement location="${gwt.dev.jar}"/>
+        <pathelement location="${gwt.codeserver.jar}"/>
+        <pathelement location="${sample.build}/war/WEB-INF/classes" />
+        <path refid="sample.extraclasspath" />
+      </classpath>
+      <arg line="${gwt.args}"/>
+      <arg line="-war"/>
+      <arg value="${sample.build}/war"/>
+      <arg value="${sample.package}.${sample.module}"/>
+    </java>
+  </target>
 </project>
diff --git a/samples/hello/build.xml b/samples/hello/build.xml
index 4f11d19..c9ee01f 100755
--- a/samples/hello/build.xml
+++ b/samples/hello/build.xml
@@ -6,28 +6,4 @@
   <!-- these are after the common.ant.xml so they have gwt.tools... -->
   <path id="sample.extraclasspath">
   </path>
-
-  <target name="devmode" description="Run development mode without building distribution">
-    <delete dir="${sample.build}/war-devmode"/>
-    <copy todir="${sample.build}/war-devmode">
-      <fileset dir="war"/>
-    </copy>
-
-    <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
-      <classpath>
-        <pathelement location="src"/>
-        <pathelement location="../../build/lib/gwt-user.jar"/>
-        <pathelement location="../../build/lib/gwt-dev.jar"/>
-        <pathelement location="../../build/lib/gwt-codeserver.jar"/>
-      </classpath>
-      <arg value="-startupUrl"/>
-      <arg value="Hello.html"/>
-      <arg value="-superDevMode"/>
-      <arg line="-war"/>
-      <arg value="${sample.build}/war-devmode"/>
-      <arg value="com.google.gwt.sample.hello.Hello"/>
-    </java>
-  </target>
-
-
 </project>
diff --git a/samples/mobilewebapp/pom.xml b/samples/mobilewebapp/pom.xml
index 0e19324..fb436ae 100644
--- a/samples/mobilewebapp/pom.xml
+++ b/samples/mobilewebapp/pom.xml
@@ -18,7 +18,7 @@
     <maven.compiler.target>1.7</maven.compiler.target>
 
     <!-- GAE properties -->
-    <gae.version>1.7.1</gae.version>
+    <gae.version>1.9.13</gae.version>
     <gae.home>${user.home}/.m2/repository/com/google/appengine/appengine-java-sdk/${gae.version}/appengine-java-sdk-${gae.version}</gae.home>
     <gae.application.version>1</gae.application.version>
 
diff --git a/samples/validation/build.xml b/samples/validation/build.xml
index 19b1d73..9b2c9af 100755
--- a/samples/validation/build.xml
+++ b/samples/validation/build.xml
@@ -1,7 +1,7 @@
 <project name="validation" default="source" basedir=".">
   <property name="sample.root" value="validation" />
   <property name="sample.module" value="Validation" />
-  <property name="sample.path" value="src" />
+  <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 etc -->
   <path id="sample.extraclasspath">
diff --git a/samples/validation/src/main/java/com/google/gwt/sample/validation/client/ValidationView.ui.xml b/samples/validation/src/main/java/com/google/gwt/sample/validation/client/ValidationView.ui.xml
index dc7c5a6..a4fbd1b 100644
--- a/samples/validation/src/main/java/com/google/gwt/sample/validation/client/ValidationView.ui.xml
+++ b/samples/validation/src/main/java/com/google/gwt/sample/validation/client/ValidationView.ui.xml
@@ -7,11 +7,10 @@
       width: 400px;
     }
     .panel {
-      align: center;
-    }
-    .send {
-      display: block;
-      font-size: 16pt;
+      position: absolute;
+      left: 50%;
+      width: 14em;
+      margin-left: -7em;
     }
     .error {
       color: red;
@@ -19,8 +18,8 @@
     .dialogPanel {
       margin: 5px;
     }
-    .close {
-      margin: 15px 6px 6px;
+    .send, .close {
+      margin: 15px 0px 6px;
     }
   </ui:style>
   <g:VerticalPanel styleName="{style.panel}">
@@ -49,4 +48,4 @@
       </g:VerticalPanel>
     </g:DialogBox>
   </g:VerticalPanel>
-</ui:UiBinder>
\ No newline at end of file
+</ui:UiBinder>