]> source.dussan.org Git - gwtquery.git/commitdiff
added an archetype to create a gquery application from scratch
authorManolo Carrasco <manolo@apache.org>
Sat, 31 Jul 2010 07:14:28 +0000 (07:14 +0000)
committerManolo Carrasco <manolo@apache.org>
Sat, 31 Jul 2010 07:14:28 +0000 (07:14 +0000)
37 files changed:
archetype/LICENSE [new file with mode: 0644]
archetype/README.txt [new file with mode: 0644]
archetype/pom.xml [new file with mode: 0644]
archetype/src/main/resources/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/.classpath [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/.project [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/README.txt [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/assembly.xml [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/pom.xml [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/src/main/webapp/index.html [new file with mode: 0644]
archetype/src/main/resources/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java [new file with mode: 0644]
archetype/target/classes/META-INF/maven/archetype-metadata.xml [new file with mode: 0644]
archetype/target/classes/archetype-resources/.classpath [new file with mode: 0644]
archetype/target/classes/archetype-resources/.project [new file with mode: 0644]
archetype/target/classes/archetype-resources/.settings/com.google.gdt.eclipse.core.prefs [new file with mode: 0644]
archetype/target/classes/archetype-resources/.settings/com.google.gwt.eclipse.core.prefs [new file with mode: 0644]
archetype/target/classes/archetype-resources/README.txt [new file with mode: 0644]
archetype/target/classes/archetype-resources/assembly.xml [new file with mode: 0644]
archetype/target/classes/archetype-resources/pom.xml [new file with mode: 0644]
archetype/target/classes/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml [new file with mode: 0644]
archetype/target/classes/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java [new file with mode: 0644]
archetype/target/classes/archetype-resources/src/main/java/__artifactId__/public/__projectName__.html [new file with mode: 0644]
archetype/target/classes/archetype-resources/src/main/webapp/WEB-INF/web.xml [new file with mode: 0644]
archetype/target/classes/archetype-resources/src/main/webapp/index.html [new file with mode: 0644]
archetype/target/classes/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java [new file with mode: 0644]
archetype/target/gquery-archetype-0.1-SNAPSHOT.jar [new file with mode: 0644]
devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java
devtest/src/main/java/com/google/gwt/query/public/test.html
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNative.java
update_demos_svn.sh

diff --git a/archetype/LICENSE b/archetype/LICENSE
new file mode 100644 (file)
index 0000000..40e1e1b
--- /dev/null
@@ -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 (file)
index 0000000..ae39f80
--- /dev/null
@@ -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 (file)
index 0000000..553a303
--- /dev/null
@@ -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 (file)
index 0000000..3dafd9d
--- /dev/null
@@ -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 (file)
index 0000000..fe43d42
--- /dev/null
@@ -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 (file)
index 0000000..79db426
--- /dev/null
@@ -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 (file)
index 0000000..91faf5f
--- /dev/null
@@ -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 (file)
index 0000000..82d4b5b
--- /dev/null
@@ -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 (file)
index 0000000..f231688
--- /dev/null
@@ -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 (file)
index 0000000..94b4832
--- /dev/null
@@ -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 (file)
index 0000000..3826e2e
--- /dev/null
@@ -0,0 +1,89 @@
+<?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
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 (file)
index 0000000..5476f93
--- /dev/null
@@ -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 (file)
index 0000000..5855c1b
--- /dev/null
@@ -0,0 +1,32 @@
+#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
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 (file)
index 0000000..6caf14b
--- /dev/null
@@ -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 (file)
index 0000000..5b52a73
--- /dev/null
@@ -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 (file)
index 0000000..6fb59b3
--- /dev/null
@@ -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 (file)
index 0000000..129f1fe
--- /dev/null
@@ -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 (file)
index 0000000..6d2be1b
--- /dev/null
@@ -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 (file)
index 0000000..fe43d42
--- /dev/null
@@ -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 (file)
index 0000000..79db426
--- /dev/null
@@ -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 (file)
index 0000000..91faf5f
--- /dev/null
@@ -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 (file)
index 0000000..82d4b5b
--- /dev/null
@@ -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 (file)
index 0000000..f231688
--- /dev/null
@@ -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 (file)
index 0000000..94b4832
--- /dev/null
@@ -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 (file)
index 0000000..3826e2e
--- /dev/null
@@ -0,0 +1,89 @@
+<?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
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 (file)
index 0000000..5476f93
--- /dev/null
@@ -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 (file)
index 0000000..5855c1b
--- /dev/null
@@ -0,0 +1,32 @@
+#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
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 (file)
index 0000000..6caf14b
--- /dev/null
@@ -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 (file)
index 0000000..5b52a73
--- /dev/null
@@ -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 (file)
index 0000000..6fb59b3
--- /dev/null
@@ -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 (file)
index 0000000..129f1fe
--- /dev/null
@@ -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 (file)
index 0000000..d747ed0
Binary files /dev/null and b/archetype/target/gquery-archetype-0.1-SNAPSHOT.jar differ
index bc64025cbd8fa16c4b8ea4f890a223827b35948d..c6e6d894a4ab162ddcdb6a32231a0d50f5c743a7 100644 (file)
 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
@@ -49,95 +49,88 @@ import com.google.gwt.user.client.Timer;
  */\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
index 5e3d76f4dfae9ab0171bec0ea687c9b75dc686d5..42e00b2abfc4293ee2540c3dbe61d40eede0078b 100644 (file)
@@ -4,6 +4,22 @@
   </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
index c3a9c0337d6ea59d502dd2d1daa15ae7d004264d..ba08268a28c6e24a1c98eec65e8870bea3fd2bb9 100644 (file)
@@ -2529,7 +2529,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
     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
index 0cc8a363c27c08bc5560f54d32bd3fbf9d384021..477e42870146624df9dca3ce20530349e0daed63 100644 (file)
@@ -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|!=).*";
   
index f21a497b1a58d0eef7a6e772c9b581ef96f39f81..f8f9afdd1161325a1fb762f752b0e1fe5a1b909e 100644 (file)
@@ -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 '{}' ';'