diff options
author | Manolo Carrasco <manolo@apache.org> | 2010-07-31 07:14:28 +0000 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2010-07-31 07:14:28 +0000 |
commit | 78ececeb3fb00fef2bd0833771c00ac512d1f286 (patch) | |
tree | 8d1d9c3a620b6a02682b369041ded646586219a6 /archetype | |
parent | d3184ec01beeeffacf8aa44c7f6adeb08da04305 (diff) | |
download | gwtquery-78ececeb3fb00fef2bd0833771c00ac512d1f286.tar.gz gwtquery-78ececeb3fb00fef2bd0833771c00ac512d1f286.zip |
added an archetype to create a gquery application from scratch
Diffstat (limited to 'archetype')
32 files changed, 917 insertions, 0 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + <groupId>com.googlecode.gwtquery</groupId> + <artifactId>gquery-archetype</artifactId> + <version>0.1-SNAPSHOT</version> + <packaging>maven-archetype</packaging> + <name>This archetype generates a Gwt project with GwtQuery</name> + + <parent> + <groupId>org.sonatype.oss</groupId> + <artifactId>oss-parent</artifactId> + <version>3</version> + </parent> + + <scm> + <connection>scm:svn:http://gwtquery.googlecode.com/svn/trunk/archetype</connection> + <developerConnection>scm:svn:https://gwtquery.googlecode.com/svn/trunk/archetype</developerConnection> + <url>http://code.google.com/p/gwtquery/source/browse/trunk/archetype</url> + </scm> + + <developers> + <developer> + <id>manolo</id> + <name>Manuel Carrasco MoƱino</name> + <email>manolo@apache.org</email> + <organization>ASF</organization> + <roles> + <role>Owner</role> + <role>Developer</role> + </roles> + </developer> + </developers> + + <build> + <extensions> + <extension> + <groupId>org.jvnet.wagon-svn</groupId> + <artifactId>wagon-svn</artifactId> + <version>1.8</version> + </extension> + <extension> + <groupId>org.apache.maven.archetype</groupId> + <artifactId>archetype-packaging</artifactId> + <version>2.0-alpha-5</version> + </extension> + </extensions> + + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-archetype-plugin</artifactId> + <version>2.0-alpha-5</version> + <extensions>true</extensions> + </plugin> + </plugins> + </pluginManagement> + + <plugins> + <plugin> + <groupId>org.riedelcastro</groupId> + <artifactId>gcupload-maven-plugin</artifactId> + <version>0.9</version> + <configuration> + <allowSnapshots>true</allowSnapshots> + <projectName>gwtquery</projectName> + <uploads> + <upload> + <extensions>jar</extensions> + <labels>Featured</labels> + </upload> + </uploads> + </configuration> + </plugin> + </plugins> + + </build> + +</project> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archetype-descriptor name="gwtquery-plugin"> + + <requiredProperties> + <requiredProperty key="projectName"/> + <requiredProperty key="version"> + <defaultValue>1.0-SNAPSHOT</defaultValue> + </requiredProperty> + </requiredProperties> + + <fileSets> + <fileSet filtered="true" encoding="UTF-8"> + <directory>.settings</directory> + <includes> + <include>**/*.prefs</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory></directory> + <includes> + <include>.project</include> + <include>.classpath</include> + <include>README.txt</include> + </includes> + </fileSet> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>src/main/java</directory> + <includes> + <include>**/*.java</include> + <include>**/*.xml</include> + <include>**/*.html</include> + </includes> + </fileSet> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>src/test/java</directory> + <includes> + <include>**/*.java</include> + <include>**/*.xml</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory>src/main/webapp</directory> + <includes> + <include>**/*.html</include> + <include>**/*.xml</include> + </includes> + </fileSet> + </fileSets> +</archetype-descriptor> 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 = '\' ) +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src/main/java"/> + <classpathentry kind="src" path="src/test/java"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/> + <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> + <classpathentry kind="output" path="src/main/webapp/WEB-INF/classes"/> +</classpath> 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 = '\' ) +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>${projectName}</name> + <comment>${projectName} is GwtQuery application</comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.google.gdt.eclipse.core.webAppProjectValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.google.gwt.eclipse.core.gwtProjectValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.maven.ide.eclipse.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.maven.ide.eclipse.maven2Nature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.google.gwt.eclipse.core.gwtNature</nature> + </natures> +</projectDescription> 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 @@ +<assembly> + <formats> + <format>zip</format> + </formats> + <baseDirectory>/${artifactId}-${version}</baseDirectory> + <files> + <file> + <outputDirectory>/</outputDirectory> + <source>plugin/target/${artifactId}-plugin-${version}.jar</source> + </file> + <file> + <outputDirectory>/</outputDirectory> + <source>sample/target/${artifactId}-sample-${version}.war</source> + </file> + </files> + <fileSets> + <fileSet> + <directory>.</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>README.txt</include> + <include>LICENSE</include> + <include>pom.xml</include> + <include>assembly.xml</include> + <include>plugin/src/**</include> + <include>plugin/pom.xml</include> + <include>sample/src/**</include> + <include>sample/pom.xml</include> + </includes> + </fileSet> + </fileSets> +</assembly> 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 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>${projectName} gwtquery project</name>
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <packaging>war</packaging>
+ <version>${version}</version>
+
+ <properties>
+ <maven.compiler.source>1.5</maven.compiler.source>
+ <maven.compiler.target>1.5</maven.compiler.target>
+ <gQueryVersion>1.0.0-SNAPSHOT</gQueryVersion>
+ <gwtversion>2.0.3</gwtversion>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>central</id>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+ <repository>
+ <id>site</id>
+ <url>http://gwtquery.googlecode.com/svn/mavenrepo</url>
+ </repository>
+ <repository>
+ <id>m.g.o</id>
+ <url>http://maven.glassfish.org/content/groups/public/</url>
+ </repository>
+ </repositories>
+
+ <scm>
+ </scm>
+
+ <issueManagement>
+ </issueManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwtquery</artifactId>
+ <version>${gQueryVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <configuration>
+ <logLevel>${gwt.loglevel}</logLevel>
+ <style>${gwt.outputstyle}</style>
+ <gwtVersion>${gwtversion}</gwtVersion>
+ <soyc>false</soyc>
+ <runTarget>${projectName}/${projectName}Sample.html</runTarget>
+ <hostedWebapp>src/main/webapp</hostedWebapp>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset><directory>src/main/webapp/${projectName}</directory></fileset>
+ <fileset><directory>src/main/webapp/WEB-INF/classes</directory></fileset>
+ <fileset><directory>tomcat</directory></fileset>
+ <fileset><directory>www-test</directory></fileset>
+ <fileset><directory>.gwt-tmp</directory></fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 = '\' ) +<module rename-to='${projectName}'> + <inherits name='com.google.gwt.query.Query'/> + <entry-point class='${package}.${artifactId}.client.${projectName}'/> +</module> + 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 = '\' ) +<!doctype html> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>GwtQuery: ${projectName} plugin example</title> +<style type="text/css"> +</style> + <script language="javascript" src="${projectName}.nocache.js"></script> +</head> + <body> + <div>Hello world</div> + </body> +</html> 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 = '\' ) +<web-app> + <welcome-file-list> + <welcome-file>${projectName}/${projectName}.html</welcome-file> + </welcome-file-list> +</web-app> 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 @@ +<html> + <head> + </head> + <body> + <script type="text/javascript"> + // a workaround for capturing and passing gwt.codesvr parameter in development mode + function goTo(location) { + window.location = location + window.location.search; + } + goTo('${projectName}/${projectName}.html'); + </script> + <h2>Loading the demo of the ${projectName} gwtquery application</h2> + </body> +</html> + 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 = $("<div></div>").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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archetype-descriptor name="gwtquery-plugin"> + + <requiredProperties> + <requiredProperty key="projectName"/> + </requiredProperties> + + <fileSets> + <fileSet filtered="true" encoding="UTF-8"> + <directory>.settings</directory> + <includes> + <include>**/*.prefs</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory></directory> + <includes> + <include>.project</include> + <include>.classpath</include> + <include>README.txt</include> + </includes> + </fileSet> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>src/main/java</directory> + <includes> + <include>**/*.java</include> + <include>**/*.xml</include> + <include>**/*.html</include> + </includes> + </fileSet> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>src/test/java</directory> + <includes> + <include>**/*.java</include> + <include>**/*.xml</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory>src/main/webapp</directory> + <includes> + <include>**/*.html</include> + <include>**/*.xml</include> + </includes> + </fileSet> + </fileSets> +</archetype-descriptor> 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 = '\' ) +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src/main/java"/> + <classpathentry kind="src" path="src/test/java"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/> + <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> + <classpathentry kind="output" path="src/main/webapp/WEB-INF/classes"/> +</classpath> 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 = '\' ) +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>${projectName}</name> + <comment>${projectName} is GwtQuery application</comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.google.gdt.eclipse.core.webAppProjectValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.google.gwt.eclipse.core.gwtProjectValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.maven.ide.eclipse.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.maven.ide.eclipse.maven2Nature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.google.gwt.eclipse.core.gwtNature</nature> + </natures> +</projectDescription> 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 @@ +<assembly> + <formats> + <format>zip</format> + </formats> + <baseDirectory>/${artifactId}-${version}</baseDirectory> + <files> + <file> + <outputDirectory>/</outputDirectory> + <source>plugin/target/${artifactId}-plugin-${version}.jar</source> + </file> + <file> + <outputDirectory>/</outputDirectory> + <source>sample/target/${artifactId}-sample-${version}.war</source> + </file> + </files> + <fileSets> + <fileSet> + <directory>.</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>README.txt</include> + <include>LICENSE</include> + <include>pom.xml</include> + <include>assembly.xml</include> + <include>plugin/src/**</include> + <include>plugin/pom.xml</include> + <include>sample/src/**</include> + <include>sample/pom.xml</include> + </includes> + </fileSet> + </fileSets> +</assembly> 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 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>${projectName} gwtquery project</name>
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <packaging>war</packaging>
+ <version>${version}</version>
+
+ <properties>
+ <maven.compiler.source>1.5</maven.compiler.source>
+ <maven.compiler.target>1.5</maven.compiler.target>
+ <gQueryVersion>1.0.0-SNAPSHOT</gQueryVersion>
+ <gwtversion>2.0.3</gwtversion>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>central</id>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+ <repository>
+ <id>site</id>
+ <url>http://gwtquery.googlecode.com/svn/mavenrepo</url>
+ </repository>
+ <repository>
+ <id>m.g.o</id>
+ <url>http://maven.glassfish.org/content/groups/public/</url>
+ </repository>
+ </repositories>
+
+ <scm>
+ </scm>
+
+ <issueManagement>
+ </issueManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwtquery</artifactId>
+ <version>${gQueryVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <configuration>
+ <logLevel>${gwt.loglevel}</logLevel>
+ <style>${gwt.outputstyle}</style>
+ <gwtVersion>${gwtversion}</gwtVersion>
+ <soyc>false</soyc>
+ <runTarget>${projectName}/${projectName}Sample.html</runTarget>
+ <hostedWebapp>src/main/webapp</hostedWebapp>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset><directory>src/main/webapp/${projectName}</directory></fileset>
+ <fileset><directory>src/main/webapp/WEB-INF/classes</directory></fileset>
+ <fileset><directory>tomcat</directory></fileset>
+ <fileset><directory>www-test</directory></fileset>
+ <fileset><directory>.gwt-tmp</directory></fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 = '\' ) +<module rename-to='${projectName}'> + <inherits name='com.google.gwt.query.Query'/> + <entry-point class='${package}.${artifactId}.client.${projectName}'/> +</module> + 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 = '\' ) +<!doctype html> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>GwtQuery: ${projectName} plugin example</title> +<style type="text/css"> +</style> + <script language="javascript" src="${projectName}.nocache.js"></script> +</head> + <body> + <div>Hello world</div> + </body> +</html> 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 = '\' ) +<web-app> + <welcome-file-list> + <welcome-file>${projectName}/${projectName}.html</welcome-file> + </welcome-file-list> +</web-app> 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 @@ +<html> + <head> + </head> + <body> + <script type="text/javascript"> + // a workaround for capturing and passing gwt.codesvr parameter in development mode + function goTo(location) { + window.location = location + window.location.search; + } + goTo('${projectName}/${projectName}.html'); + </script> + <h2>Loading the demo of the ${projectName} gwtquery application</h2> + </body> +</html> + 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 = $("<div></div>").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 Binary files differnew file mode 100644 index 00000000..d747ed0e --- /dev/null +++ b/archetype/target/gquery-archetype-0.1-SNAPSHOT.jar |