--- /dev/null
+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.
+
--- /dev/null
+
+
+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
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+#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>
--- /dev/null
+#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>
--- /dev/null
+eclipse.preferences.version=1
+jarsExcludedFromWebInfLib=
+warSrcDir=src/main/webapp
+warSrcDirIsOutput=true
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+eclipse.preferences.version=1
+entryPointModules=${package}.${artifactId}.${projectName}
+filesCopiedToWebInfLib=gwt-servlet.jar
--- /dev/null
+
+
+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
--- /dev/null
+<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>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project>\r
+ <modelVersion>4.0.0</modelVersion>\r
+ \r
+ <name>${projectName} gwtquery project</name>\r
+ <groupId>${groupId}</groupId>\r
+ <artifactId>${artifactId}</artifactId>\r
+ <packaging>war</packaging>\r
+ <version>${version}</version>\r
+\r
+ <properties>\r
+ <maven.compiler.source>1.5</maven.compiler.source>\r
+ <maven.compiler.target>1.5</maven.compiler.target>\r
+ <gQueryVersion>1.0.0-SNAPSHOT</gQueryVersion>\r
+ <gwtversion>2.0.3</gwtversion>\r
+ </properties>\r
+\r
+ <repositories>\r
+ <repository>\r
+ <id>central</id>\r
+ <url>http://repo1.maven.org/maven2</url>\r
+ </repository>\r
+ <repository>\r
+ <id>site</id>\r
+ <url>http://gwtquery.googlecode.com/svn/mavenrepo</url>\r
+ </repository>\r
+ <repository>\r
+ <id>m.g.o</id>\r
+ <url>http://maven.glassfish.org/content/groups/public/</url>\r
+ </repository>\r
+ </repositories>\r
+\r
+ <scm>\r
+ </scm>\r
+\r
+ <issueManagement>\r
+ </issueManagement>\r
+\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>junit</groupId>\r
+ <artifactId>junit</artifactId>\r
+ <version>3.8.1</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.google.gwt</groupId>\r
+ <artifactId>gwtquery</artifactId>\r
+ <version>${gQueryVersion}</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ </dependencies>\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.codehaus.mojo</groupId>\r
+ <artifactId>gwt-maven-plugin</artifactId>\r
+ <configuration>\r
+ <logLevel>${gwt.loglevel}</logLevel>\r
+ <style>${gwt.outputstyle}</style>\r
+ <gwtVersion>${gwtversion}</gwtVersion>\r
+ <soyc>false</soyc>\r
+ <runTarget>${projectName}/${projectName}Sample.html</runTarget>\r
+ <hostedWebapp>src/main/webapp</hostedWebapp>\r
+ </configuration>\r
+ <executions>\r
+ <execution>\r
+ <phase>prepare-package</phase>\r
+ <goals>\r
+ <goal>compile</goal>\r
+ </goals>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+ <plugin>\r
+ <artifactId>maven-clean-plugin</artifactId>\r
+ <configuration>\r
+ <filesets>\r
+ <fileset><directory>src/main/webapp/${projectName}</directory></fileset>\r
+ <fileset><directory>src/main/webapp/WEB-INF/classes</directory></fileset>\r
+ <fileset><directory>tomcat</directory></fileset>\r
+ <fileset><directory>www-test</directory></fileset>\r
+ <fileset><directory>.gwt-tmp</directory></fileset>\r
+ </filesets>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+</project>\r
--- /dev/null
+#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>
+
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.${artifactId}.client;\r
+import com.google.gwt.dom.client.Element;\r
+import com.google.gwt.query.client.Function;\r
+import static com.google.gwt.query.client.GQuery.*;\r
+import static com.google.gwt.query.client.plugins.Effects.Effects;\r
+\r
+\r
+import com.google.gwt.core.client.EntryPoint;\r
+\r
+/**\r
+ * Example code for a GwtQuery application\r
+ */\r
+public class ${projectName} implements EntryPoint {\r
+\r
+ public void onModuleLoad() {\r
+ \r
+ ${symbol_dollar}("div")\r
+ .hover(new Function() {\r
+ public void f(Element e) {\r
+ ${symbol_dollar}(e).css("color", "blue").as(Effects).stop().animate("fontSize: '+=10px'");\r
+ }\r
+ }, new Function() {\r
+ public void f(Element e) {\r
+ ${symbol_dollar}(e).css("color", "").as(Effects).stop().animate("fontSize: '-=10px'");\r
+ }\r
+ });\r
+ }\r
+\r
+}\r
--- /dev/null
+#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>
--- /dev/null
+#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>
--- /dev/null
+<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>
+
--- /dev/null
+#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);
+ }
+
+}
--- /dev/null
+<?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>
--- /dev/null
+#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>
--- /dev/null
+#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>
--- /dev/null
+eclipse.preferences.version=1
+jarsExcludedFromWebInfLib=
+warSrcDir=src/main/webapp
+warSrcDirIsOutput=true
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+eclipse.preferences.version=1
+entryPointModules=${package}.${artifactId}.${projectName}
+filesCopiedToWebInfLib=gwt-servlet.jar
--- /dev/null
+
+
+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
--- /dev/null
+<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>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project>\r
+ <modelVersion>4.0.0</modelVersion>\r
+ \r
+ <name>${projectName} gwtquery project</name>\r
+ <groupId>${groupId}</groupId>\r
+ <artifactId>${artifactId}</artifactId>\r
+ <packaging>war</packaging>\r
+ <version>${version}</version>\r
+\r
+ <properties>\r
+ <maven.compiler.source>1.5</maven.compiler.source>\r
+ <maven.compiler.target>1.5</maven.compiler.target>\r
+ <gQueryVersion>1.0.0-SNAPSHOT</gQueryVersion>\r
+ <gwtversion>2.0.3</gwtversion>\r
+ </properties>\r
+\r
+ <repositories>\r
+ <repository>\r
+ <id>central</id>\r
+ <url>http://repo1.maven.org/maven2</url>\r
+ </repository>\r
+ <repository>\r
+ <id>site</id>\r
+ <url>http://gwtquery.googlecode.com/svn/mavenrepo</url>\r
+ </repository>\r
+ <repository>\r
+ <id>m.g.o</id>\r
+ <url>http://maven.glassfish.org/content/groups/public/</url>\r
+ </repository>\r
+ </repositories>\r
+\r
+ <scm>\r
+ </scm>\r
+\r
+ <issueManagement>\r
+ </issueManagement>\r
+\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>junit</groupId>\r
+ <artifactId>junit</artifactId>\r
+ <version>3.8.1</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.google.gwt</groupId>\r
+ <artifactId>gwtquery</artifactId>\r
+ <version>${gQueryVersion}</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ </dependencies>\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.codehaus.mojo</groupId>\r
+ <artifactId>gwt-maven-plugin</artifactId>\r
+ <configuration>\r
+ <logLevel>${gwt.loglevel}</logLevel>\r
+ <style>${gwt.outputstyle}</style>\r
+ <gwtVersion>${gwtversion}</gwtVersion>\r
+ <soyc>false</soyc>\r
+ <runTarget>${projectName}/${projectName}Sample.html</runTarget>\r
+ <hostedWebapp>src/main/webapp</hostedWebapp>\r
+ </configuration>\r
+ <executions>\r
+ <execution>\r
+ <phase>prepare-package</phase>\r
+ <goals>\r
+ <goal>compile</goal>\r
+ </goals>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+ <plugin>\r
+ <artifactId>maven-clean-plugin</artifactId>\r
+ <configuration>\r
+ <filesets>\r
+ <fileset><directory>src/main/webapp/${projectName}</directory></fileset>\r
+ <fileset><directory>src/main/webapp/WEB-INF/classes</directory></fileset>\r
+ <fileset><directory>tomcat</directory></fileset>\r
+ <fileset><directory>www-test</directory></fileset>\r
+ <fileset><directory>.gwt-tmp</directory></fileset>\r
+ </filesets>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+</project>\r
--- /dev/null
+#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>
+
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.${artifactId}.client;\r
+import com.google.gwt.dom.client.Element;\r
+import com.google.gwt.query.client.Function;\r
+import static com.google.gwt.query.client.GQuery.*;\r
+import static com.google.gwt.query.client.plugins.Effects.Effects;\r
+\r
+\r
+import com.google.gwt.core.client.EntryPoint;\r
+\r
+/**\r
+ * Example code for a GwtQuery application\r
+ */\r
+public class ${projectName} implements EntryPoint {\r
+\r
+ public void onModuleLoad() {\r
+ \r
+ ${symbol_dollar}("div")\r
+ .hover(new Function() {\r
+ public void f(Element e) {\r
+ ${symbol_dollar}(e).css("color", "blue").as(Effects).stop().animate("fontSize: '+=10px'");\r
+ }\r
+ }, new Function() {\r
+ public void f(Element e) {\r
+ ${symbol_dollar}(e).css("color", "").as(Effects).stop().animate("fontSize: '-=10px'");\r
+ }\r
+ });\r
+ }\r
+\r
+}\r
--- /dev/null
+#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>
--- /dev/null
+#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>
--- /dev/null
+<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>
+
--- /dev/null
+#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);
+ }
+
+}
package com.google.gwt.query.client;\r
\r
import static com.google.gwt.query.client.GQuery.$;\r
-import static com.google.gwt.query.client.GQuery.body;\r
-import static com.google.gwt.query.client.plugins.Effects.Effects;\r
\r
import com.google.gwt.core.client.EntryPoint;\r
import com.google.gwt.core.client.GWT;\r
import com.google.gwt.dom.client.Document;\r
import com.google.gwt.dom.client.Element;\r
import com.google.gwt.dom.client.NodeList;\r
+import com.google.gwt.event.dom.client.ClickEvent;\r
+import com.google.gwt.event.dom.client.ClickHandler;\r
import com.google.gwt.event.dom.client.FocusHandler;\r
import com.google.gwt.event.shared.GwtEvent;\r
import com.google.gwt.event.shared.HandlerRegistration;\r
-import com.google.gwt.query.client.impl.SelectorEngineCssToXPath;\r
import com.google.gwt.query.client.impl.SelectorEngineImpl;\r
-import com.google.gwt.query.client.impl.SelectorEngineJS;\r
-import com.google.gwt.query.client.impl.SelectorEngineNative;\r
-import com.google.gwt.query.client.impl.SelectorEngineSizzle;\r
-import com.google.gwt.query.client.impl.SelectorEngineSizzleGwt;\r
-import com.google.gwt.query.client.impl.SelectorEngineXPath;\r
-import com.google.gwt.query.client.plugins.Effects;\r
+import com.google.gwt.user.client.Event;\r
import com.google.gwt.user.client.Timer;\r
+import com.google.gwt.user.client.ui.Button;\r
+import com.google.gwt.user.client.ui.Composite;\r
+import com.google.gwt.user.client.ui.HTML;\r
+import com.google.gwt.user.client.ui.RootPanel;\r
+import com.google.gwt.user.client.ui.SimplePanel;\r
+import com.google.gwt.user.client.ui.Widget;\r
\r
/**\r
* This module is thought to emulate a test environment similar to\r
*/\r
public class DevTestRunner extends MyTestCase implements EntryPoint {\r
\r
- public void test() {\r
- Effects e = $().as(Effects).dequeue();\r
- }\r
-\r
static native String $j (String s) /*-{\r
return "" + eval(s);\r
}-*/;\r
\r
- public void testSelectorsInIframe() {\r
- $(e).html("<iframe name='miframe' id='miframe' src=\"javascript:''\">");\r
- Element d = $("#miframe").contents().empty().get(0);\r
- assertNotNull(d);\r
- \r
- $(d).html(\r
- "<div class='branchA'><div class='target'>branchA target</div></div>"\r
- + "<div class='branchB'><div class='target'>branchB target</div></div>");\r
- \r
- \r
- executeSelectInAllImplementations(".branchA .target", d, 1);\r
- executeSelectInAllImplementations(".branchA .target", body, 0);\r
- executeSelectInAllImplementations("div .target", d, 2);\r
- executeSelectInAllImplementations("div .target", body, 0);\r
-\r
-// TestSelectors selectors = GWT.create(TestSelectors.class);\r
-// assertEquals(1, selectors.branchAtarget(d).length());\r
-// assertEquals(0, selectors.branchAtarget().length());\r
-// assertEquals(2, selectors.divTarget(d).length());\r
-// assertEquals(0, selectors.divTarget().length());\r
-\r
- }\r
- private void executeSelectInAllImplementations(String selector, Element elem, Object... array) {\r
- SelectorEngineImpl selSizz = new SelectorEngineSizzle();\r
- SelectorEngineImpl selSizzGwt = new SelectorEngineSizzleGwt();\r
- SelectorEngineImpl selJS = new SelectorEngineJS();\r
- SelectorEngineImpl selXpath = new SelectorEngineXPath();\r
- SelectorEngineImpl selC2X = new SelectorEngineCssToXPath();\r
- SelectorEngineImpl selNative = new SelectorEngineNative();\r
- assertArrayContains(selector, selSizz.select(selector, elem).getLength(), array);\r
- assertArrayContains(selector, selSizzGwt.select(selector, elem).getLength(), array);\r
- assertArrayContains(selector, selJS.select(selector, elem).getLength(), array);\r
- assertArrayContains(selector, selNative.select(selector, elem).getLength(), array);\r
- assertArrayContains(selector, selXpath.select(selector, elem).getLength(), array);\r
- assertArrayContains(selector, selC2X.select(selector, elem).getLength(), array);\r
- }\r
- \r
- public void testIFrameManipulation() {\r
- $(e).html("<iframe name='miframe' id='miframe' src=\"javascript:''\">");\r
- Document d = $("#miframe").contents().empty().get(0).cast();\r
- $(d).html(getTestContent());\r
- \r
- SelectorEngineImpl s = new SelectorEngineSizzle();\r
- System.out.println(s.select("div", d).getLength());\r
- System.out.println(s.select("div", GQuery.document).getLength());\r
- s = new SelectorEngineSizzleGwt();\r
- System.out.println(s.select("div", d).getLength());\r
- System.out.println(s.select("div", GQuery.document).getLength());\r
- s = new SelectorEngineJS();\r
- System.out.println(s.select("div", d).getLength());\r
- System.out.println(s.select("div", GQuery.document).getLength());\r
- s = new SelectorEngineNative();\r
- System.out.println(s.select("div", d).getLength());\r
- System.out.println(s.select("div", GQuery.document).getLength());\r
- s = new SelectorEngineCssToXPath();\r
- System.out.println(s.select("div", d).getLength());\r
- System.out.println(s.select("div", GQuery.document).getLength());\r
- s = new SelectorEngineXPath();\r
- System.out.println(s.select("div", d).getLength());\r
- System.out.println(s.select("div", GQuery.document).getLength());\r
-// \r
-// assertNotNull(d);\r
-// assertNotNull(d.getBody());\r
-// assertEquals(1, $("#miframe").contents().size());\r
-// assertEquals(1, $("#miframe").contents().find("body").size());\r
-// assertEquals(0, $("#miframe").contents().find("body > h1").size());\r
-// $("#miframe").contents().find("body").append("<h1>Test</h1>");\r
-// assertEquals(1, $("#miframe").contents().find("body > h1").size());\r
-// assertEquals(1, $(d).find("h1").size());\r
- }\r
\r
public void onModuleLoad() {\r
try {\r
gwtSetUp();\r
- testSelectorsInIframe();\r
+ testCompiledSelectors();\r
+ System.out.println("ok");\r
} catch (Exception ex) {\r
ex.printStackTrace();\r
$(e).html("").after("<div>ERROR: " + ex.getMessage() + "</div>");\r
}\r
}\r
\r
+ public void myTest() {\r
+ Strangeness s = new Strangeness();\r
+ RootPanel.get().add(s);\r
+ }\r
+ \r
+ \r
+ public class Strangeness extends SimplePanel {\r
+ private final Button noprob;\r
+ private final Dilemma prob;\r
+\r
+ public Strangeness() {\r
+ this.noprob = new Button("toggle");\r
+ this.prob = new Dilemma();\r
+\r
+ // The button has a click handler to toggle ...\r
+ this.noprob.addClickHandler(new ClickHandler() {\r
+ public void onClick(ClickEvent event) {\r
+ toggle();\r
+\r
+ }\r
+\r
+ });\r
+ // ... and the dilemma will use gwt-query to toggle.\r
+\r
+ setWidget(prob);\r
+ }\r
+\r
+ protected void toggle() {\r
+ setWidget(getWidget() == noprob ? prob : noprob);\r
+ }\r
+\r
+ private class Dilemma extends Composite {\r
+ private final Widget label;\r
+\r
+ public Dilemma() {\r
+ label = new HTML("<div class='dilemma'>I am a dilemma.</div>");\r
+ initWidget(label);\r
+ }\r
+\r
+ @Override\r
+ protected void onLoad() {\r
+ super.onLoad();\r
+ // This works:\r
+ // $(".dilemma") // (*)\r
+ // but this not:\r
+ $(label.getElement()) // (**)\r
+ .mousedown(new Function() {\r
+ @Override\r
+ public boolean f(Event e) {\r
+ toggle();\r
+ return true;\r
+ }\r
+ });\r
+ }\r
+\r
+ @Override\r
+ protected void onUnload() {\r
+ // $(".dilemma").unbind(Event.ONMOUSEDOWN); (*)\r
+// $(label.getElement()).unbind(Event.ONMOUSEDOWN); // (**)\r
+ super.onUnload();\r
+ }\r
+ }\r
+ }\r
+ \r
+ \r
+ \r
public void testDomManip() {\r
String content = "<p>First</p><p class=\"selected\">Hello</p><p>How are you?</p>";\r
String expected = "<p class=\"selected\">Hello</p>"; \r
</head>\r
<body>\r
<script language="javascript" src="test.nocache.js"></script>\r
+ <script language="javascript" src="jquery-1.3.1.js"></script>\r
+ \r
+ <button id="a">A</button>\r
+ <button id="b">B</button>\r
+ <script>\r
+ var a = $("#a");\r
+ var b = $("#b");\r
+ $(a).toggle(function() {\r
+ $(b).remove();\r
+ },function() {\r
+ $(a).after($(b));\r
+ });\r
+ $(b).click(function() {\r
+ alert("b clicked");\r
+ });\r
+ </script>\r
</body>\r
</html>\r
\ No newline at end of file
item = item == window ? windowData : item;\r
int id = item.hashCode();\r
if (name != null) {\r
- if (!dataCache.exists(id)) {\r
+ if (dataCache.exists(id)) {\r
dataCache.getCache(id).delete(name);\r
}\r
if (dataCache.getCache(id).isEmpty()) {\r
* Runtime selector engine implementation for browsers with native
* querySelectorAll support.
*/
-public class SelectorEngineNative extends SelectorEngineSizzle {
+public class SelectorEngineNative extends SelectorEngineCssToXPath {
public static String NATIVE_EXCEPTIONS_REGEXP = ".*(:contains|!=).*";
find demos | grep -v .svn | xargs svn add
find demos -type f -name "*html" -exec svn propset svn:mime-type text/html '{}' ';'
+find demos -type f -name "*js" -exec svn propset svn:mime-type text/javascript '{}' ';'