From 78ececeb3fb00fef2bd0833771c00ac512d1f286 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Sat, 31 Jul 2010 07:14:28 +0000 Subject: added an archetype to create a gquery application from scratch --- archetype/LICENSE | 23 +++ archetype/README.txt | 19 +++ archetype/pom.xml | 80 ++++++++++ .../META-INF/maven/archetype-metadata.xml | 49 +++++++ .../main/resources/archetype-resources/.classpath | 13 ++ .../main/resources/archetype-resources/.project | 37 +++++ .../.settings/com.google.gdt.eclipse.core.prefs | 4 + .../.settings/com.google.gwt.eclipse.core.prefs | 6 + .../main/resources/archetype-resources/README.txt | 27 ++++ .../resources/archetype-resources/assembly.xml | 32 ++++ .../src/main/resources/archetype-resources/pom.xml | 89 ++++++++++++ .../java/__artifactId__/__projectName__.gwt.xml | 8 + .../__artifactId__/client/__projectName__.java | 32 ++++ .../__artifactId__/public/__projectName__.html | 16 ++ .../src/main/webapp/WEB-INF/web.xml | 8 + .../archetype-resources/src/main/webapp/index.html | 15 ++ .../__artifactId__/client/__projectName__Test.java | 63 ++++++++ .../classes/META-INF/maven/archetype-metadata.xml | 46 ++++++ .../target/classes/archetype-resources/.classpath | 13 ++ .../target/classes/archetype-resources/.project | 37 +++++ .../.settings/com.google.gdt.eclipse.core.prefs | 4 + .../.settings/com.google.gwt.eclipse.core.prefs | 6 + .../target/classes/archetype-resources/README.txt | 27 ++++ .../classes/archetype-resources/assembly.xml | 32 ++++ .../target/classes/archetype-resources/pom.xml | 89 ++++++++++++ .../java/__artifactId__/__projectName__.gwt.xml | 8 + .../__artifactId__/client/__projectName__.java | 32 ++++ .../__artifactId__/public/__projectName__.html | 16 ++ .../src/main/webapp/WEB-INF/web.xml | 8 + .../archetype-resources/src/main/webapp/index.html | 15 ++ .../__artifactId__/client/__projectName__Test.java | 63 ++++++++ archetype/target/gquery-archetype-0.1-SNAPSHOT.jar | Bin 0 -> 7424 bytes .../com/google/gwt/query/client/DevTestRunner.java | 161 ++++++++++----------- .../java/com/google/gwt/query/public/test.html | 16 ++ .../java/com/google/gwt/query/client/GQuery.java | 2 +- .../query/client/impl/SelectorEngineNative.java | 2 +- update_demos_svn.sh | 1 + 37 files changed, 1013 insertions(+), 86 deletions(-) create mode 100644 archetype/LICENSE create mode 100644 archetype/README.txt create mode 100644 archetype/pom.xml create mode 100644 archetype/src/main/resources/META-INF/maven/archetype-metadata.xml create mode 100644 archetype/src/main/resources/archetype-resources/.classpath create mode 100644 archetype/src/main/resources/archetype-resources/.project create mode 100644 archetype/src/main/resources/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs create mode 100644 archetype/src/main/resources/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs create mode 100644 archetype/src/main/resources/archetype-resources/README.txt create mode 100644 archetype/src/main/resources/archetype-resources/assembly.xml create mode 100644 archetype/src/main/resources/archetype-resources/pom.xml create mode 100644 archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml create mode 100644 archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java create mode 100644 archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html create mode 100644 archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml create mode 100644 archetype/src/main/resources/archetype-resources/src/main/webapp/index.html create mode 100644 archetype/src/main/resources/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java create mode 100644 archetype/target/classes/META-INF/maven/archetype-metadata.xml create mode 100644 archetype/target/classes/archetype-resources/.classpath create mode 100644 archetype/target/classes/archetype-resources/.project create mode 100644 archetype/target/classes/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs create mode 100644 archetype/target/classes/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs create mode 100644 archetype/target/classes/archetype-resources/README.txt create mode 100644 archetype/target/classes/archetype-resources/assembly.xml create mode 100644 archetype/target/classes/archetype-resources/pom.xml create mode 100644 archetype/target/classes/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml create mode 100644 archetype/target/classes/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java create mode 100644 archetype/target/classes/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html create mode 100644 archetype/target/classes/archetype-resources/src/main/webapp/WEB-INF/web.xml create mode 100644 archetype/target/classes/archetype-resources/src/main/webapp/index.html create mode 100644 archetype/target/classes/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java create mode 100644 archetype/target/gquery-archetype-0.1-SNAPSHOT.jar diff --git a/archetype/LICENSE b/archetype/LICENSE new file mode 100644 index 00000000..40e1e1b9 --- /dev/null +++ b/archetype/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2010, gwtquery team + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + diff --git a/archetype/README.txt b/archetype/README.txt new file mode 100644 index 00000000..ae39f801 --- /dev/null +++ b/archetype/README.txt @@ -0,0 +1,19 @@ + + +This is the archetype to create new GwtQuery applications. + +- Assuming you have installed maven, compile and install it just running: +$ mvn clean install + +- To use the archetype run: +$ mvn archetype:generate -DarchetypeGroupId=com.googlecode.gwtquery \ + -DarchetypeArtifactId=gquery-archetype \ + -DarchetypeVersion=0.1 + -DartifactId=myproject \ + -DpluginName=MyProject + +- Then change to the folder myplugin and run: +$ mvn clean install + +- To run the application just run: +$ mvn gwt:run diff --git a/archetype/pom.xml b/archetype/pom.xml new file mode 100644 index 00000000..553a3039 --- /dev/null +++ b/archetype/pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + com.googlecode.gwtquery + gquery-archetype + 0.1-SNAPSHOT + maven-archetype + This archetype generates a Gwt project with GwtQuery + + + org.sonatype.oss + oss-parent + 3 + + + + scm:svn:http://gwtquery.googlecode.com/svn/trunk/archetype + scm:svn:https://gwtquery.googlecode.com/svn/trunk/archetype + http://code.google.com/p/gwtquery/source/browse/trunk/archetype + + + + + manolo + Manuel Carrasco MoƱino + manolo@apache.org + ASF + + Owner + Developer + + + + + + + + org.jvnet.wagon-svn + wagon-svn + 1.8 + + + org.apache.maven.archetype + archetype-packaging + 2.0-alpha-5 + + + + + + + maven-archetype-plugin + 2.0-alpha-5 + true + + + + + + + org.riedelcastro + gcupload-maven-plugin + 0.9 + + true + gwtquery + + + jar + Featured + + + + + + + + + diff --git a/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 00000000..3dafd9dc --- /dev/null +++ b/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,49 @@ + + + + + + + 1.0-SNAPSHOT + + + + + + .settings + + **/*.prefs + + + + + + .project + .classpath + README.txt + + + + src/main/java + + **/*.java + **/*.xml + **/*.html + + + + src/test/java + + **/*.java + **/*.xml + + + + src/main/webapp + + **/*.html + **/*.xml + + + + diff --git a/archetype/src/main/resources/archetype-resources/.classpath b/archetype/src/main/resources/archetype-resources/.classpath new file mode 100644 index 00000000..fe43d429 --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/.classpath @@ -0,0 +1,13 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + + + + + + + + diff --git a/archetype/src/main/resources/archetype-resources/.project b/archetype/src/main/resources/archetype-resources/.project new file mode 100644 index 00000000..79db426b --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/.project @@ -0,0 +1,37 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + ${projectName} + ${projectName} is GwtQuery application + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.google.gdt.eclipse.core.webAppProjectValidator + + + + + com.google.gwt.eclipse.core.gwtProjectValidator + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.maven.ide.eclipse.maven2Nature + org.eclipse.jdt.core.javanature + com.google.gwt.eclipse.core.gwtNature + + diff --git a/archetype/src/main/resources/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs b/archetype/src/main/resources/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs new file mode 100644 index 00000000..91faf5fc --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +jarsExcludedFromWebInfLib= +warSrcDir=src/main/webapp +warSrcDirIsOutput=true diff --git a/archetype/src/main/resources/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs b/archetype/src/main/resources/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs new file mode 100644 index 00000000..82d4b5b7 --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs @@ -0,0 +1,6 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +eclipse.preferences.version=1 +entryPointModules=${package}.${artifactId}.${projectName} +filesCopiedToWebInfLib=gwt-servlet.jar diff --git a/archetype/src/main/resources/archetype-resources/README.txt b/archetype/src/main/resources/archetype-resources/README.txt new file mode 100644 index 00000000..f231688a --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/README.txt @@ -0,0 +1,27 @@ + + +This is the project ${projectName} which uses the GwtQuery Library. + +- Assuming you have installed maven, compile and install it just running: +$ mvn clean install + +- Run it in development mode: +$ mvn gwt:run + +- Import and run in Eclipse: + + The archetype generates a project ready to be used in eclipse, + but before importing it you have to install the following plugins: + + * Google plugin for eclipse (update-site: http://dl.google.com/eclipse/plugin/3.6) + * Sonatype Maven plugin (update-site: http://m2eclipse.sonatype.org/site/m2e) + * Subversion plugin (update-site: http://subclipse.tigris.org/update_1.6.x) + + Then you can import the project in your eclipse workspace: + + * File -> Import -> Existing Projects into Workspace + + Finally you should be able to run the project in development mode and to run the gwt test unit. + + * Right click on the project -> Run as -> Web Application + * Right click on the test class -> Run as -> GWT JUnit Test diff --git a/archetype/src/main/resources/archetype-resources/assembly.xml b/archetype/src/main/resources/archetype-resources/assembly.xml new file mode 100644 index 00000000..94b4832a --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/assembly.xml @@ -0,0 +1,32 @@ + + + zip + + /${artifactId}-${version} + + + / + plugin/target/${artifactId}-plugin-${version}.jar + + + / + sample/target/${artifactId}-sample-${version}.war + + + + + . + / + + README.txt + LICENSE + pom.xml + assembly.xml + plugin/src/** + plugin/pom.xml + sample/src/** + sample/pom.xml + + + + diff --git a/archetype/src/main/resources/archetype-resources/pom.xml b/archetype/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 00000000..3826e2ea --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + + ${projectName} gwtquery project + ${groupId} + ${artifactId} + war + ${version} + + + 1.5 + 1.5 + 1.0.0-SNAPSHOT + 2.0.3 + + + + + central + http://repo1.maven.org/maven2 + + + site + http://gwtquery.googlecode.com/svn/mavenrepo + + + m.g.o + http://maven.glassfish.org/content/groups/public/ + + + + + + + + + + + + junit + junit + 3.8.1 + test + + + com.google.gwt + gwtquery + ${gQueryVersion} + provided + + + + + + org.codehaus.mojo + gwt-maven-plugin + + ${gwt.loglevel} + + ${gwtversion} + false + ${projectName}/${projectName}Sample.html + src/main/webapp + + + + prepare-package + + compile + + + + + + maven-clean-plugin + + + src/main/webapp/${projectName} + src/main/webapp/WEB-INF/classes + tomcat + www-test + .gwt-tmp + + + + + + diff --git a/archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml b/archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml new file mode 100644 index 00000000..5476f939 --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml @@ -0,0 +1,8 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + + + diff --git a/archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java b/archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java new file mode 100644 index 00000000..5855c1b6 --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java @@ -0,0 +1,32 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}.${artifactId}.client; +import com.google.gwt.dom.client.Element; +import com.google.gwt.query.client.Function; +import static com.google.gwt.query.client.GQuery.*; +import static com.google.gwt.query.client.plugins.Effects.Effects; + + +import com.google.gwt.core.client.EntryPoint; + +/** + * Example code for a GwtQuery application + */ +public class ${projectName} implements EntryPoint { + + public void onModuleLoad() { + + ${symbol_dollar}("div") + .hover(new Function() { + public void f(Element e) { + ${symbol_dollar}(e).css("color", "blue").as(Effects).stop().animate("fontSize: '+=10px'"); + } + }, new Function() { + public void f(Element e) { + ${symbol_dollar}(e).css("color", "").as(Effects).stop().animate("fontSize: '-=10px'"); + } + }); + } + +} diff --git a/archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html b/archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html new file mode 100644 index 00000000..6caf14bf --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html @@ -0,0 +1,16 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + + +GwtQuery: ${projectName} plugin example + + + + +
Hello world
+ + diff --git a/archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml b/archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..5b52a739 --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,8 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + ${projectName}/${projectName}.html + + diff --git a/archetype/src/main/resources/archetype-resources/src/main/webapp/index.html b/archetype/src/main/resources/archetype-resources/src/main/webapp/index.html new file mode 100644 index 00000000..6fb59b37 --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/src/main/webapp/index.html @@ -0,0 +1,15 @@ + + + + + +

Loading the demo of the ${projectName} gwtquery application

+ + + diff --git a/archetype/src/main/resources/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java b/archetype/src/main/resources/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java new file mode 100644 index 00000000..129f1fea --- /dev/null +++ b/archetype/src/main/resources/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java @@ -0,0 +1,63 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}.${artifactId}.client; + +import static com.google.gwt.query.client.GQuery.*; +import com.google.gwt.junit.client.GWTTestCase; +import com.google.gwt.query.client.GQUtils; +import com.google.gwt.query.client.GQuery; +import com.google.gwt.query.client.plugins.Effects.Speed; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.Timer; +/** + * Test class for ${projecName} entry-point + */ +public class ${projectName}Test extends GWTTestCase { + + public String getModuleName() { + return "${package}.${artifactId}.${projectName}"; + } + + private double fontSize(GQuery g) { + return GQUtils.cur(g.get(0), "fontSize", true); + } + + public void testOnModuleLoad() { + + // execute the plugin method + final GQuery g = $("
").appendTo(document); + + // run onModuleLoad + Art a = new Art(); + a.onModuleLoad(); + + // delay the test + delayTestFinish(Speed.DEFAULT * 3); + + // trigger mouse over event + final double size1 = fontSize(g); + g.trigger(Event.ONMOUSEOVER); + new Timer() { + public void run() { + // assert that the font size increases + assertTrue(fontSize(g) > size1); + + // trigger mouse out event + final double size2 = fontSize(g); + g.trigger(Event.ONMOUSEOUT); + new Timer() { + public void run() { + // assert that the font size decreases + assertTrue(fontSize(g) < size2); + g.remove(); + + // finish the test + finishTest(); + } + }.schedule(Speed.DEFAULT); + } + }.schedule(Speed.DEFAULT); + } + +} diff --git a/archetype/target/classes/META-INF/maven/archetype-metadata.xml b/archetype/target/classes/META-INF/maven/archetype-metadata.xml new file mode 100644 index 00000000..6d2be1bc --- /dev/null +++ b/archetype/target/classes/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,46 @@ + + + + + + + + + + .settings + + **/*.prefs + + + + + + .project + .classpath + README.txt + + + + src/main/java + + **/*.java + **/*.xml + **/*.html + + + + src/test/java + + **/*.java + **/*.xml + + + + src/main/webapp + + **/*.html + **/*.xml + + + + diff --git a/archetype/target/classes/archetype-resources/.classpath b/archetype/target/classes/archetype-resources/.classpath new file mode 100644 index 00000000..fe43d429 --- /dev/null +++ b/archetype/target/classes/archetype-resources/.classpath @@ -0,0 +1,13 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + + + + + + + + diff --git a/archetype/target/classes/archetype-resources/.project b/archetype/target/classes/archetype-resources/.project new file mode 100644 index 00000000..79db426b --- /dev/null +++ b/archetype/target/classes/archetype-resources/.project @@ -0,0 +1,37 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + ${projectName} + ${projectName} is GwtQuery application + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.google.gdt.eclipse.core.webAppProjectValidator + + + + + com.google.gwt.eclipse.core.gwtProjectValidator + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.maven.ide.eclipse.maven2Nature + org.eclipse.jdt.core.javanature + com.google.gwt.eclipse.core.gwtNature + + diff --git a/archetype/target/classes/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs b/archetype/target/classes/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs new file mode 100644 index 00000000..91faf5fc --- /dev/null +++ b/archetype/target/classes/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +jarsExcludedFromWebInfLib= +warSrcDir=src/main/webapp +warSrcDirIsOutput=true diff --git a/archetype/target/classes/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs b/archetype/target/classes/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs new file mode 100644 index 00000000..82d4b5b7 --- /dev/null +++ b/archetype/target/classes/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs @@ -0,0 +1,6 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +eclipse.preferences.version=1 +entryPointModules=${package}.${artifactId}.${projectName} +filesCopiedToWebInfLib=gwt-servlet.jar diff --git a/archetype/target/classes/archetype-resources/README.txt b/archetype/target/classes/archetype-resources/README.txt new file mode 100644 index 00000000..f231688a --- /dev/null +++ b/archetype/target/classes/archetype-resources/README.txt @@ -0,0 +1,27 @@ + + +This is the project ${projectName} which uses the GwtQuery Library. + +- Assuming you have installed maven, compile and install it just running: +$ mvn clean install + +- Run it in development mode: +$ mvn gwt:run + +- Import and run in Eclipse: + + The archetype generates a project ready to be used in eclipse, + but before importing it you have to install the following plugins: + + * Google plugin for eclipse (update-site: http://dl.google.com/eclipse/plugin/3.6) + * Sonatype Maven plugin (update-site: http://m2eclipse.sonatype.org/site/m2e) + * Subversion plugin (update-site: http://subclipse.tigris.org/update_1.6.x) + + Then you can import the project in your eclipse workspace: + + * File -> Import -> Existing Projects into Workspace + + Finally you should be able to run the project in development mode and to run the gwt test unit. + + * Right click on the project -> Run as -> Web Application + * Right click on the test class -> Run as -> GWT JUnit Test diff --git a/archetype/target/classes/archetype-resources/assembly.xml b/archetype/target/classes/archetype-resources/assembly.xml new file mode 100644 index 00000000..94b4832a --- /dev/null +++ b/archetype/target/classes/archetype-resources/assembly.xml @@ -0,0 +1,32 @@ + + + zip + + /${artifactId}-${version} + + + / + plugin/target/${artifactId}-plugin-${version}.jar + + + / + sample/target/${artifactId}-sample-${version}.war + + + + + . + / + + README.txt + LICENSE + pom.xml + assembly.xml + plugin/src/** + plugin/pom.xml + sample/src/** + sample/pom.xml + + + + diff --git a/archetype/target/classes/archetype-resources/pom.xml b/archetype/target/classes/archetype-resources/pom.xml new file mode 100644 index 00000000..3826e2ea --- /dev/null +++ b/archetype/target/classes/archetype-resources/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + + ${projectName} gwtquery project + ${groupId} + ${artifactId} + war + ${version} + + + 1.5 + 1.5 + 1.0.0-SNAPSHOT + 2.0.3 + + + + + central + http://repo1.maven.org/maven2 + + + site + http://gwtquery.googlecode.com/svn/mavenrepo + + + m.g.o + http://maven.glassfish.org/content/groups/public/ + + + + + + + + + + + + junit + junit + 3.8.1 + test + + + com.google.gwt + gwtquery + ${gQueryVersion} + provided + + + + + + org.codehaus.mojo + gwt-maven-plugin + + ${gwt.loglevel} + + ${gwtversion} + false + ${projectName}/${projectName}Sample.html + src/main/webapp + + + + prepare-package + + compile + + + + + + maven-clean-plugin + + + src/main/webapp/${projectName} + src/main/webapp/WEB-INF/classes + tomcat + www-test + .gwt-tmp + + + + + + diff --git a/archetype/target/classes/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml b/archetype/target/classes/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml new file mode 100644 index 00000000..5476f939 --- /dev/null +++ b/archetype/target/classes/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml @@ -0,0 +1,8 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + + + diff --git a/archetype/target/classes/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java b/archetype/target/classes/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java new file mode 100644 index 00000000..5855c1b6 --- /dev/null +++ b/archetype/target/classes/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java @@ -0,0 +1,32 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}.${artifactId}.client; +import com.google.gwt.dom.client.Element; +import com.google.gwt.query.client.Function; +import static com.google.gwt.query.client.GQuery.*; +import static com.google.gwt.query.client.plugins.Effects.Effects; + + +import com.google.gwt.core.client.EntryPoint; + +/** + * Example code for a GwtQuery application + */ +public class ${projectName} implements EntryPoint { + + public void onModuleLoad() { + + ${symbol_dollar}("div") + .hover(new Function() { + public void f(Element e) { + ${symbol_dollar}(e).css("color", "blue").as(Effects).stop().animate("fontSize: '+=10px'"); + } + }, new Function() { + public void f(Element e) { + ${symbol_dollar}(e).css("color", "").as(Effects).stop().animate("fontSize: '-=10px'"); + } + }); + } + +} diff --git a/archetype/target/classes/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html b/archetype/target/classes/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html new file mode 100644 index 00000000..6caf14bf --- /dev/null +++ b/archetype/target/classes/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html @@ -0,0 +1,16 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + + +GwtQuery: ${projectName} plugin example + + + + +
Hello world
+ + diff --git a/archetype/target/classes/archetype-resources/src/main/webapp/WEB-INF/web.xml b/archetype/target/classes/archetype-resources/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..5b52a739 --- /dev/null +++ b/archetype/target/classes/archetype-resources/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,8 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) + + + ${projectName}/${projectName}.html + + diff --git a/archetype/target/classes/archetype-resources/src/main/webapp/index.html b/archetype/target/classes/archetype-resources/src/main/webapp/index.html new file mode 100644 index 00000000..6fb59b37 --- /dev/null +++ b/archetype/target/classes/archetype-resources/src/main/webapp/index.html @@ -0,0 +1,15 @@ + + + + + +

Loading the demo of the ${projectName} gwtquery application

+ + + diff --git a/archetype/target/classes/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java b/archetype/target/classes/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java new file mode 100644 index 00000000..129f1fea --- /dev/null +++ b/archetype/target/classes/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java @@ -0,0 +1,63 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}.${artifactId}.client; + +import static com.google.gwt.query.client.GQuery.*; +import com.google.gwt.junit.client.GWTTestCase; +import com.google.gwt.query.client.GQUtils; +import com.google.gwt.query.client.GQuery; +import com.google.gwt.query.client.plugins.Effects.Speed; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.Timer; +/** + * Test class for ${projecName} entry-point + */ +public class ${projectName}Test extends GWTTestCase { + + public String getModuleName() { + return "${package}.${artifactId}.${projectName}"; + } + + private double fontSize(GQuery g) { + return GQUtils.cur(g.get(0), "fontSize", true); + } + + public void testOnModuleLoad() { + + // execute the plugin method + final GQuery g = $("
").appendTo(document); + + // run onModuleLoad + Art a = new Art(); + a.onModuleLoad(); + + // delay the test + delayTestFinish(Speed.DEFAULT * 3); + + // trigger mouse over event + final double size1 = fontSize(g); + g.trigger(Event.ONMOUSEOVER); + new Timer() { + public void run() { + // assert that the font size increases + assertTrue(fontSize(g) > size1); + + // trigger mouse out event + final double size2 = fontSize(g); + g.trigger(Event.ONMOUSEOUT); + new Timer() { + public void run() { + // assert that the font size decreases + assertTrue(fontSize(g) < size2); + g.remove(); + + // finish the test + finishTest(); + } + }.schedule(Speed.DEFAULT); + } + }.schedule(Speed.DEFAULT); + } + +} diff --git a/archetype/target/gquery-archetype-0.1-SNAPSHOT.jar b/archetype/target/gquery-archetype-0.1-SNAPSHOT.jar new file mode 100644 index 00000000..d747ed0e Binary files /dev/null and b/archetype/target/gquery-archetype-0.1-SNAPSHOT.jar differ diff --git a/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java b/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java index bc64025c..c6e6d894 100644 --- a/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java +++ b/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java @@ -16,26 +16,26 @@ package com.google.gwt.query.client; import static com.google.gwt.query.client.GQuery.$; -import static com.google.gwt.query.client.GQuery.body; -import static com.google.gwt.query.client.plugins.Effects.Effects; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.NodeList; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.query.client.impl.SelectorEngineCssToXPath; import com.google.gwt.query.client.impl.SelectorEngineImpl; -import com.google.gwt.query.client.impl.SelectorEngineJS; -import com.google.gwt.query.client.impl.SelectorEngineNative; -import com.google.gwt.query.client.impl.SelectorEngineSizzle; -import com.google.gwt.query.client.impl.SelectorEngineSizzleGwt; -import com.google.gwt.query.client.impl.SelectorEngineXPath; -import com.google.gwt.query.client.plugins.Effects; +import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Timer; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.SimplePanel; +import com.google.gwt.user.client.ui.Widget; /** * This module is thought to emulate a test environment similar to @@ -49,95 +49,88 @@ import com.google.gwt.user.client.Timer; */ public class DevTestRunner extends MyTestCase implements EntryPoint { - public void test() { - Effects e = $().as(Effects).dequeue(); - } - static native String $j (String s) /*-{ return "" + eval(s); }-*/; - public void testSelectorsInIframe() { - $(e).html("