aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2010-07-31 07:14:28 +0000
committerManolo Carrasco <manolo@apache.org>2010-07-31 07:14:28 +0000
commit78ececeb3fb00fef2bd0833771c00ac512d1f286 (patch)
tree8d1d9c3a620b6a02682b369041ded646586219a6
parentd3184ec01beeeffacf8aa44c7f6adeb08da04305 (diff)
downloadgwtquery-78ececeb3fb00fef2bd0833771c00ac512d1f286.tar.gz
gwtquery-78ececeb3fb00fef2bd0833771c00ac512d1f286.zip
added an archetype to create a gquery application from scratch
-rw-r--r--archetype/LICENSE23
-rw-r--r--archetype/README.txt19
-rw-r--r--archetype/pom.xml80
-rw-r--r--archetype/src/main/resources/META-INF/maven/archetype-metadata.xml49
-rw-r--r--archetype/src/main/resources/archetype-resources/.classpath13
-rw-r--r--archetype/src/main/resources/archetype-resources/.project37
-rw-r--r--archetype/src/main/resources/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs4
-rw-r--r--archetype/src/main/resources/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs6
-rw-r--r--archetype/src/main/resources/archetype-resources/README.txt27
-rw-r--r--archetype/src/main/resources/archetype-resources/assembly.xml32
-rw-r--r--archetype/src/main/resources/archetype-resources/pom.xml89
-rw-r--r--archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml8
-rw-r--r--archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java32
-rw-r--r--archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html16
-rw-r--r--archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml8
-rw-r--r--archetype/src/main/resources/archetype-resources/src/main/webapp/index.html15
-rw-r--r--archetype/src/main/resources/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java63
-rw-r--r--archetype/target/classes/META-INF/maven/archetype-metadata.xml46
-rw-r--r--archetype/target/classes/archetype-resources/.classpath13
-rw-r--r--archetype/target/classes/archetype-resources/.project37
-rw-r--r--archetype/target/classes/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs4
-rw-r--r--archetype/target/classes/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs6
-rw-r--r--archetype/target/classes/archetype-resources/README.txt27
-rw-r--r--archetype/target/classes/archetype-resources/assembly.xml32
-rw-r--r--archetype/target/classes/archetype-resources/pom.xml89
-rw-r--r--archetype/target/classes/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml8
-rw-r--r--archetype/target/classes/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java32
-rw-r--r--archetype/target/classes/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html16
-rw-r--r--archetype/target/classes/archetype-resources/src/main/webapp/WEB-INF/web.xml8
-rw-r--r--archetype/target/classes/archetype-resources/src/main/webapp/index.html15
-rw-r--r--archetype/target/classes/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java63
-rw-r--r--archetype/target/gquery-archetype-0.1-SNAPSHOT.jarbin0 -> 7424 bytes
-rw-r--r--devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java161
-rw-r--r--devtest/src/main/java/com/google/gwt/query/public/test.html16
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java2
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNative.java2
-rw-r--r--update_demos_svn.sh1
37 files changed, 1013 insertions, 86 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
new file mode 100644
index 00000000..d747ed0e
--- /dev/null
+++ b/archetype/target/gquery-archetype-0.1-SNAPSHOT.jar
Binary files 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("<iframe name='miframe' id='miframe' src=\"javascript:''\">");
- Element d = $("#miframe").contents().empty().get(0);
- assertNotNull(d);
-
- $(d).html(
- "<div class='branchA'><div class='target'>branchA target</div></div>"
- + "<div class='branchB'><div class='target'>branchB target</div></div>");
-
-
- executeSelectInAllImplementations(".branchA .target", d, 1);
- executeSelectInAllImplementations(".branchA .target", body, 0);
- executeSelectInAllImplementations("div .target", d, 2);
- executeSelectInAllImplementations("div .target", body, 0);
-
-// TestSelectors selectors = GWT.create(TestSelectors.class);
-// assertEquals(1, selectors.branchAtarget(d).length());
-// assertEquals(0, selectors.branchAtarget().length());
-// assertEquals(2, selectors.divTarget(d).length());
-// assertEquals(0, selectors.divTarget().length());
-
- }
- private void executeSelectInAllImplementations(String selector, Element elem, Object... array) {
- SelectorEngineImpl selSizz = new SelectorEngineSizzle();
- SelectorEngineImpl selSizzGwt = new SelectorEngineSizzleGwt();
- SelectorEngineImpl selJS = new SelectorEngineJS();
- SelectorEngineImpl selXpath = new SelectorEngineXPath();
- SelectorEngineImpl selC2X = new SelectorEngineCssToXPath();
- SelectorEngineImpl selNative = new SelectorEngineNative();
- assertArrayContains(selector, selSizz.select(selector, elem).getLength(), array);
- assertArrayContains(selector, selSizzGwt.select(selector, elem).getLength(), array);
- assertArrayContains(selector, selJS.select(selector, elem).getLength(), array);
- assertArrayContains(selector, selNative.select(selector, elem).getLength(), array);
- assertArrayContains(selector, selXpath.select(selector, elem).getLength(), array);
- assertArrayContains(selector, selC2X.select(selector, elem).getLength(), array);
- }
-
- public void testIFrameManipulation() {
- $(e).html("<iframe name='miframe' id='miframe' src=\"javascript:''\">");
- Document d = $("#miframe").contents().empty().get(0).cast();
- $(d).html(getTestContent());
-
- SelectorEngineImpl s = new SelectorEngineSizzle();
- System.out.println(s.select("div", d).getLength());
- System.out.println(s.select("div", GQuery.document).getLength());
- s = new SelectorEngineSizzleGwt();
- System.out.println(s.select("div", d).getLength());
- System.out.println(s.select("div", GQuery.document).getLength());
- s = new SelectorEngineJS();
- System.out.println(s.select("div", d).getLength());
- System.out.println(s.select("div", GQuery.document).getLength());
- s = new SelectorEngineNative();
- System.out.println(s.select("div", d).getLength());
- System.out.println(s.select("div", GQuery.document).getLength());
- s = new SelectorEngineCssToXPath();
- System.out.println(s.select("div", d).getLength());
- System.out.println(s.select("div", GQuery.document).getLength());
- s = new SelectorEngineXPath();
- System.out.println(s.select("div", d).getLength());
- System.out.println(s.select("div", GQuery.document).getLength());
-//
-// assertNotNull(d);
-// assertNotNull(d.getBody());
-// assertEquals(1, $("#miframe").contents().size());
-// assertEquals(1, $("#miframe").contents().find("body").size());
-// assertEquals(0, $("#miframe").contents().find("body > h1").size());
-// $("#miframe").contents().find("body").append("<h1>Test</h1>");
-// assertEquals(1, $("#miframe").contents().find("body > h1").size());
-// assertEquals(1, $(d).find("h1").size());
- }
public void onModuleLoad() {
try {
gwtSetUp();
- testSelectorsInIframe();
+ testCompiledSelectors();
+ System.out.println("ok");
} catch (Exception ex) {
ex.printStackTrace();
$(e).html("").after("<div>ERROR: " + ex.getMessage() + "</div>");
}
}
+ public void myTest() {
+ Strangeness s = new Strangeness();
+ RootPanel.get().add(s);
+ }
+
+
+ public class Strangeness extends SimplePanel {
+ private final Button noprob;
+ private final Dilemma prob;
+
+ public Strangeness() {
+ this.noprob = new Button("toggle");
+ this.prob = new Dilemma();
+
+ // The button has a click handler to toggle ...
+ this.noprob.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ toggle();
+
+ }
+
+ });
+ // ... and the dilemma will use gwt-query to toggle.
+
+ setWidget(prob);
+ }
+
+ protected void toggle() {
+ setWidget(getWidget() == noprob ? prob : noprob);
+ }
+
+ private class Dilemma extends Composite {
+ private final Widget label;
+
+ public Dilemma() {
+ label = new HTML("<div class='dilemma'>I am a dilemma.</div>");
+ initWidget(label);
+ }
+
+ @Override
+ protected void onLoad() {
+ super.onLoad();
+ // This works:
+ // $(".dilemma") // (*)
+ // but this not:
+ $(label.getElement()) // (**)
+ .mousedown(new Function() {
+ @Override
+ public boolean f(Event e) {
+ toggle();
+ return true;
+ }
+ });
+ }
+
+ @Override
+ protected void onUnload() {
+ // $(".dilemma").unbind(Event.ONMOUSEDOWN); (*)
+// $(label.getElement()).unbind(Event.ONMOUSEDOWN); // (**)
+ super.onUnload();
+ }
+ }
+ }
+
+
+
public void testDomManip() {
String content = "<p>First</p><p class=\"selected\">Hello</p><p>How are you?</p>";
String expected = "<p class=\"selected\">Hello</p>";
diff --git a/devtest/src/main/java/com/google/gwt/query/public/test.html b/devtest/src/main/java/com/google/gwt/query/public/test.html
index 5e3d76f4..42e00b2a 100644
--- a/devtest/src/main/java/com/google/gwt/query/public/test.html
+++ b/devtest/src/main/java/com/google/gwt/query/public/test.html
@@ -4,6 +4,22 @@
</head>
<body>
<script language="javascript" src="test.nocache.js"></script>
+ <script language="javascript" src="jquery-1.3.1.js"></script>
+
+ <button id="a">A</button>
+ <button id="b">B</button>
+ <script>
+ var a = $("#a");
+ var b = $("#b");
+ $(a).toggle(function() {
+ $(b).remove();
+ },function() {
+ $(a).after($(b));
+ });
+ $(b).click(function() {
+ alert("b clicked");
+ });
+ </script>
</body>
</html>
\ No newline at end of file
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
index c3a9c033..ba08268a 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
@@ -2529,7 +2529,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
item = item == window ? windowData : item;
int id = item.hashCode();
if (name != null) {
- if (!dataCache.exists(id)) {
+ if (dataCache.exists(id)) {
dataCache.getCache(id).delete(name);
}
if (dataCache.getCache(id).isEmpty()) {
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNative.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNative.java
index 0cc8a363..477e4287 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNative.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNative.java
@@ -24,7 +24,7 @@ import com.google.gwt.query.client.SelectorEngine;
* 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|!=).*";
diff --git a/update_demos_svn.sh b/update_demos_svn.sh
index f21a497b..f8f9afdd 100644
--- a/update_demos_svn.sh
+++ b/update_demos_svn.sh
@@ -20,3 +20,4 @@ done
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 '{}' ';'