aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/DeferredGQuery.java43
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java19
-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/JSRegexp.java (renamed from gwtquery-core/src/main/java/com/google/gwt/query/client/Regexp.java)8
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/Predicate.java9
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/Selectors.java44
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java (renamed from gwtquery-core/src/main/java/com/google/gwt/query/client/SelectorEngine.java)4
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java5
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java2
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNative.java1
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeIE8.java1
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMin.java1
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMinIE8.java1
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineJS.java60
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineXPath.java22
-rwxr-xr-xgwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java1
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Events.java1
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryQueue.java1
-rwxr-xr-xgwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryUi.java1
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEffects.java1
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEvents.java1
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java1
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Plugin.java (renamed from gwtquery-core/src/main/java/com/google/gwt/query/client/Plugin.java)4
-rwxr-xr-xgwtquery-core/src/main/java/com/google/gwt/query/client/plugins/PropertiesAnimation.java6
-rwxr-xr-xgwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java1
-rwxr-xr-xgwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/Widgets.java2
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/rebind/SelectorGeneratorBase.java21
-rw-r--r--samples/pom.xml2
-rw-r--r--samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java26
29 files changed, 146 insertions, 145 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/DeferredGQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/DeferredGQuery.java
deleted file mode 100644
index 2eade06d..00000000
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/DeferredGQuery.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2011, The gwtquery team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.query.client;
-
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Node;
-import com.google.gwt.dom.client.NodeList;
-
-/**
- * A compiled selector that can be lazily turned into a GQuery.
- */
-public interface DeferredGQuery {
-
- /**
- * Evaluate the compiled selector with the given DOM node as a context.
- * Returns a NodeList as a result.
- */
- NodeList<Element> array(Node ctx);
-
- /**
- * Evaluate the compiled selector with the given DOM node as a context.
- * Returns the result as a GQuery object.
- */
- GQuery eval(Node ctx);
-
- /**
- * The selector which was compiled.
- */
- String getSelector();
-}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java
index 0f1c6ddf..9f8336c6 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java
@@ -25,14 +25,13 @@ import com.google.gwt.user.client.ui.Widget;
public abstract class Function {
/**
- * Override this to define a cancel action.
+ * Override this for methods which invoke a cancel action.
*/
public void cancel(Element e) {
}
/**
* Override this to define a function which does not need any parameter.
- *
*/
public void f() {
throw new RuntimeException("You have to override the adequate method to handle this action, or you have to override 'public void f()' to avoid this error");
@@ -78,8 +77,10 @@ public abstract class Function {
}
/**
- * Override this for GQuery methods which take a callback, but do not expect a
- * return value, apply to a single element only.
+ * Override this for GQuery methods which take a callback and do not expect a
+ * return value.
+ *
+ * @param e takes a com.google.gwt.dom.client.Element
*/
public void f(Element e) {
Widget w = GQuery.getAssociatedWidget(e);
@@ -90,7 +91,12 @@ public abstract class Function {
}
}
-
+ /**
+ * Override this for GQuery methods which take a callback and do not expect a
+ * return value.
+ *
+ * @param e takes a com.google.gwt.user.client.Element
+ */
public void f(com.google.gwt.user.client.Element e) {
f((Element)e);
}
@@ -100,9 +106,8 @@ public abstract class Function {
* return value, apply to a single widget.
*
* NOTE: If your query is returning non-widget elements you might need to override
- * 'public void f()' or 'public void f(Element e)' to handle these elements or to
+ * 'public void f()' or 'public void f(Element e)' to handle these elements and
* avoid a runtime exception.
- *
*/
public void f(Widget w){
f();
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 24bb7dd4..e018f1d8 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
@@ -41,7 +41,9 @@ import com.google.gwt.query.client.css.HasCssValue;
import com.google.gwt.query.client.css.TakesCssValue;
import com.google.gwt.query.client.css.TakesCssValue.CssSetter;
import com.google.gwt.query.client.impl.DocumentStyleImpl;
+import com.google.gwt.query.client.impl.SelectorEngine;
import com.google.gwt.query.client.plugins.EventsListener;
+import com.google.gwt.query.client.plugins.Plugin;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventListener;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Regexp.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/JSRegexp.java
index ec8ca0a8..0e2b1f62 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Regexp.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/JSRegexp.java
@@ -20,7 +20,7 @@ import com.google.gwt.core.client.JavaScriptObject;
/**
* A wrapper around Javascript Regexps.
*/
-public class Regexp {
+public class JSRegexp {
public static native JavaScriptObject compile(String pat) /*-{
return new RegExp(pat);
@@ -31,7 +31,7 @@ public class Regexp {
}-*/;
public static JSArray match(String regexp, String flags, String string) {
- return new Regexp(regexp, flags).match(string);
+ return new JSRegexp(regexp, flags).match(string);
}
private static native JSArray exec0(JavaScriptObject regexp, String str) /*-{
@@ -40,11 +40,11 @@ public class Regexp {
private final JavaScriptObject regexp;
- public Regexp(String pattern) {
+ public JSRegexp(String pattern) {
this.regexp = compile(pattern);
}
- public Regexp(String pat, String flags) {
+ public JSRegexp(String pat, String flags) {
this.regexp = compileFlags(pat, flags);
}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Predicate.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/Predicate.java
index ab4f7dde..e52b233b 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Predicate.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/Predicate.java
@@ -22,5 +22,14 @@ import com.google.gwt.dom.client.Element;
*/
public interface Predicate {
+ /**
+ * Used by GQuery methods which loop over matched widgets and
+ * invoke a callback on each widget expecting a boolean value.
+ *
+ * @param e
+ * the element for this call
+ * @param index
+ * the element position in the gquery elements array.
+ */
boolean f(Element e, int index);
}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Selectors.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/Selectors.java
index 89b16ddf..b14021bb 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Selectors.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/Selectors.java
@@ -15,18 +15,58 @@
*/
package com.google.gwt.query.client;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
+import com.google.gwt.dom.client.NodeList;
/**
* Tagging interface used to generate compile time selectors.
*/
public interface Selectors {
+
+ /**
+ * A compiled selector that can be lazily turned into a GQuery.
+ */
+ public interface DeferredSelector {
+
+ /**
+ * Evaluate the compiled selector with the given DOM node as a context.
+ *
+ * Returns a NodeList as a result which you could transform into a GQuery
+ * object passing it as argument to the $() function.
+ */
+ NodeList<Element> runSelector(Node ctx);
+
+ /**
+ * The selector which was compiled.
+ */
+ String getSelector();
+ }
- DeferredGQuery[] getAllSelectors();
+ /**
+ * Return all the selectors defined for this interface, so as
+ * we can get the css representation of each one and lazily evaluate it
+ * in runtime.
+ */
+ DeferredSelector[] getAllSelectors();
+ /**
+ * Set the context for all the selectors.
+ * By default they are evaluated in all the document.
+ */
public void setRoot(Node node);
+ /**
+ * Get the configured root context.
+ */
public Node getRoot();
-
+
+ /**
+ * Used for benchmarking purposes, it returns true if the selector engine
+ * for this browser is using a pure javascript implementation or a native
+ * one.
+ *
+ * It is useful to check if IE8 native selectors are being used.
+ */
public boolean isDegradated();
}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/SelectorEngine.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java
index 78808c6f..8d7abf75 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/SelectorEngine.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java
@@ -13,14 +13,14 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.query.client;
+package com.google.gwt.query.client.impl;
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.Node;
import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.query.client.impl.SelectorEngineImpl;
+import com.google.gwt.query.client.JSArray;
/**
* Core Selector engine functions, and native JS utility functions.
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java
index 255329f5..fed3bea8 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java
@@ -24,8 +24,7 @@ import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.GQUtils;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Regexp;
-import com.google.gwt.query.client.SelectorEngine;
+import com.google.gwt.query.client.JSRegexp;
/**
* Runtime selector engine implementation which translates selectors to XPath
@@ -150,7 +149,7 @@ public class SelectorEngineCssToXPath extends SelectorEngineImpl {
// when using this engine in generators and tests for the JVM
private Replacer replacer = new Replacer() {
public String replaceAll(String s, String r, Object o) {
- Regexp p = new Regexp(r);
+ JSRegexp p = new JSRegexp(r);
if (o instanceof ReplaceCallback) {
ReplaceCallback callback = (ReplaceCallback) o;
while (p.test(s)) {
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java
index 07cba9bf..eee63054 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java
@@ -19,7 +19,7 @@ import static com.google.gwt.query.client.GQUtils.truth;
import com.google.gwt.query.client.GQUtils;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Regexp;
+import com.google.gwt.query.client.JSRegexp;
/**
* Base/Utility class for runtime selector engine implementations.
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 6aed5676..c7aa2101 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
@@ -19,7 +19,6 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.query.client.SelectorEngine;
/**
* Runtime selector engine implementation for browsers with native
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeIE8.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeIE8.java
index 5e21d5b6..bc55b50c 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeIE8.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeIE8.java
@@ -18,7 +18,6 @@ package com.google.gwt.query.client.impl;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.query.client.SelectorEngine;
/**
* Runtime selector engine implementation for IE with native
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMin.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMin.java
index af4c64c4..e08f81f1 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMin.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMin.java
@@ -18,7 +18,6 @@ package com.google.gwt.query.client.impl;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.query.client.SelectorEngine;
import com.google.gwt.user.client.Window;
/**
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMinIE8.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMinIE8.java
index c32938b4..932503ce 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMinIE8.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMinIE8.java
@@ -18,7 +18,6 @@ package com.google.gwt.query.client.impl;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.query.client.SelectorEngine;
import com.google.gwt.user.client.Window;
/**
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineJS.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineJS.java
index 270d02b5..e1ac1ae7 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineJS.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineJS.java
@@ -26,8 +26,8 @@ import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.GQUtils;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Regexp;
-import com.google.gwt.query.client.SelectorEngine;
+import com.google.gwt.query.client.JSRegexp;
+import com.google.gwt.query.client.impl.SelectorEngine;
import com.google.gwt.query.client.impl.SelectorEngineImpl;
/**
@@ -90,7 +90,7 @@ public class SelectorEngineJS extends SelectorEngineImpl {
protected static Sequence getSequence(String expression) {
int start = 0, add = 2, max = -1, modVal = -1;
- Regexp expressionRegExp = new Regexp(
+ JSRegexp expressionRegExp = new JSRegexp(
"^((odd|even)|([1-9]\\d*)|((([1-9]\\d*)?)n((\\+|\\-)(\\d+))?)|(\\-(([1-9]\\d*)?)n\\+(\\d+)))$");
JSArray pseudoValue = expressionRegExp.exec(expression);
if (!truth(pseudoValue)) {
@@ -212,7 +212,7 @@ public class SelectorEngineJS extends SelectorEngineImpl {
}
private static void getGeneralSiblingNodes(JSArray matchingElms,
- JSArray nextTag, Regexp nextRegExp, Node prevRef) {
+ JSArray nextTag, JSRegexp nextRegExp, Node prevRef) {
while (
GQUtils.truth((prevRef = SelectorEngine.getNextSibling(prevRef)))
&& !isAdded(prevRef)) {
@@ -225,7 +225,7 @@ public class SelectorEngineJS extends SelectorEngineImpl {
}
private static void getSiblingNodes(JSArray matchingElms, JSArray nextTag,
- Regexp nextRegExp, Node prevRef) {
+ JSRegexp nextRegExp, Node prevRef) {
while (
GQUtils.truth(prevRef = SelectorEngine.getNextSibling(prevRef))
&& prevRef.getNodeType() != Node.ELEMENT_NODE) {
@@ -267,16 +267,16 @@ public class SelectorEngineJS extends SelectorEngineImpl {
return arr;
}-*/;
- private Regexp cssSelectorRegExp;
+ private JSRegexp cssSelectorRegExp;
- private Regexp selectorSplitRegExp;
+ private JSRegexp selectorSplitRegExp;
- private Regexp childOrSiblingRefRegExp;
+ private JSRegexp childOrSiblingRefRegExp;
public SelectorEngineJS() {
- selectorSplitRegExp = new Regexp("[^\\s]+", "g");
- childOrSiblingRefRegExp = new Regexp("^(>|\\+|~)$");
- cssSelectorRegExp = new Regexp(
+ selectorSplitRegExp = new JSRegexp("[^\\s]+", "g");
+ childOrSiblingRefRegExp = new JSRegexp("^(>|\\+|~)$");
+ cssSelectorRegExp = new JSRegexp(
"^(\\w+)?(#[\\w\\u00C0-\\uFFFF\\-\\_]+|(\\*))?((\\.[\\w\\u00C0-\\uFFFF\\-_]+)*)?((\\[\\w+(\\^|\\$|\\*|\\||~)?(=[\"']*[\\w\\u00C0-\\uFFFF\\s\\-\\_\\.]+[\"']*)?\\]+)*)?(((:\\w+[\\w\\-]*)(\\((odd|even|\\-?\\d*n?((\\+|\\-)\\d+)?|[\\w\\u00C0-\\uFFFF\\-_]+|((\\w*\\.[\\w\\u00C0-\\uFFFF\\-_]+)*)?|(\\[#?\\w+(\\^|\\$|\\*|\\||~)?=?[\\w\\u00C0-\\uFFFF\\s\\-\\_\\.]+\\]+)|(:\\w+[\\w\\-]*))\\))?)*)?");
}
@@ -306,13 +306,13 @@ public class SelectorEngineJS extends SelectorEngineImpl {
if (i > 0 && childOrSiblingRefRegExp.test(rule)) {
JSArray childOrSiblingRef = childOrSiblingRefRegExp.exec(rule);
if (GQUtils.truth(childOrSiblingRef)) {
- JSArray nextTag = new Regexp("^\\w+")
+ JSArray nextTag = new JSRegexp("^\\w+")
.exec(cssSelectors.getStr(i + 1));
- Regexp nextRegExp = null;
+ JSRegexp nextRegExp = null;
String nextTagStr = null;
if (GQUtils.truth(nextTag)) {
nextTagStr = nextTag.getStr(0);
- nextRegExp = new Regexp("(^|\\s)" + nextTagStr + "(\\s|$)", "i");
+ nextRegExp = new JSRegexp("(^|\\s)" + nextTagStr + "(\\s|$)", "i");
}
for (int j = 0, jlen = prevElem.size(); j < jlen; j++) {
Node prevRef = prevElem.getNode(j);
@@ -329,7 +329,7 @@ public class SelectorEngineJS extends SelectorEngineImpl {
prevElem = matchingElms;
clearAdded(prevElem);
rule = cssSelectors.getStr(++i);
- if (new Regexp("^\\w+$").test(rule)) {
+ if (new JSRegexp("^\\w+$").test(rule)) {
continue;
}
setSkipTag(prevElem, true);
@@ -379,9 +379,9 @@ public class SelectorEngineJS extends SelectorEngineImpl {
if (GQUtils.truth(splitRule.allClasses)) {
String[] allClasses = splitRule.allClasses.replaceFirst("^\\.", "")
.split("\\.");
- Regexp[] regExpClassNames = new Regexp[allClasses.length];
+ JSRegexp[] regExpClassNames = new JSRegexp[allClasses.length];
for (int n = 0, nl = allClasses.length; n < nl; n++) {
- regExpClassNames[n] = new Regexp(
+ regExpClassNames[n] = new JSRegexp(
"(^|\\s)" + allClasses[n] + "(\\s|$)");
}
JSArray matchingClassElms = JSArray.create();
@@ -406,11 +406,11 @@ public class SelectorEngineJS extends SelectorEngineImpl {
prevElem = matchingElms = matchingClassElms;
}
if (GQUtils.truth(splitRule.allAttr)) {
- JSArray allAttr = Regexp
+ JSArray allAttr = JSRegexp
.match("\\[[^\\]]+\\]", "g", splitRule.allAttr);
- Regexp[] regExpAttributes = new Regexp[allAttr.size()];
+ JSRegexp[] regExpAttributes = new JSRegexp[allAttr.size()];
String[] regExpAttributesStr = new String[allAttr.size()];
- Regexp attributeMatchRegExp = new Regexp(
+ JSRegexp attributeMatchRegExp = new JSRegexp(
"(\\w+)(\\^|\\$|\\*|\\||~)?=?[\"']?([\\w\u00C0-\uFFFF\\s\\-_\\.]+)?");
for (int q = 0, ql = allAttr.size(); q < ql; q++) {
JSArray attributeMatch = attributeMatchRegExp
@@ -421,7 +421,7 @@ public class SelectorEngineJS extends SelectorEngineImpl {
: null;
String attrVal = attrToRegExp(attributeValue,
(GQUtils.or(attributeMatch.getStr(2), null)));
- regExpAttributes[q] = (GQUtils.truth(attrVal) ? new Regexp(
+ regExpAttributes[q] = (GQUtils.truth(attrVal) ? new JSRegexp(
attrVal) : null);
regExpAttributesStr[q] = attributeMatch.getStr(1);
}
@@ -433,7 +433,7 @@ public class SelectorEngineJS extends SelectorEngineImpl {
for (int s = 0, sl = regExpAttributes.length;
s < sl; s++) {
addElm = false;
- Regexp attributeRegexp = regExpAttributes[s];
+ JSRegexp attributeRegexp = regExpAttributes[s];
String currentAttr = getAttr(current, regExpAttributesStr[s]);
if (GQUtils.truth(currentAttr)
&& currentAttr.length() != 0) {
@@ -453,10 +453,10 @@ public class SelectorEngineJS extends SelectorEngineImpl {
prevElem = matchingElms = matchingAttributeElms;
}
if (GQUtils.truth(splitRule.allPseudos)) {
- Regexp pseudoSplitRegExp = new Regexp(
+ JSRegexp pseudoSplitRegExp = new JSRegexp(
":(\\w[\\w\\-]*)(\\(([^\\)]+)\\))?");
- JSArray allPseudos = Regexp
+ JSArray allPseudos = JSRegexp
.match("(:\\w+[\\w\\-]*)(\\([^\\)]+\\))?", "g",
splitRule.allPseudos);
for (int t = 0, tl = allPseudos.size(); t < tl; t++) {
@@ -638,19 +638,19 @@ public class SelectorEngineJS extends SelectorEngineImpl {
private JSArray getNotPseudo(JSArray previousMatch, String pseudoValue,
JSArray matchingElms) {
- if (new Regexp("(:\\w+[\\w\\-]*)$").test(pseudoValue)) {
+ if (new JSRegexp("(:\\w+[\\w\\-]*)$").test(pseudoValue)) {
matchingElms = subtractArray(previousMatch,
getElementsByPseudo(previousMatch, pseudoValue.substring(1), ""));
} else {
pseudoValue = pseudoValue
.replace("^\\[#([\\w\\u00C0-\\uFFFF\\-\\_]+)\\]$", "[id=$1]");
- JSArray notTag = new Regexp("^(\\w+)").exec(pseudoValue);
- JSArray notClass = new Regexp("^\\.([\\w\u00C0-\uFFFF\\-_]+)")
+ JSArray notTag = new JSRegexp("^(\\w+)").exec(pseudoValue);
+ JSArray notClass = new JSRegexp("^\\.([\\w\u00C0-\uFFFF\\-_]+)")
.exec(pseudoValue);
- JSArray notAttr = new Regexp(
+ JSArray notAttr = new JSRegexp(
"\\[(\\w+)(\\^|\\$|\\*|\\||~)?=?([\\w\\u00C0-\\uFFFF\\s\\-_\\.]+)?\\]")
.exec(pseudoValue);
- Regexp notRegExp = new Regexp("(^|\\s)"
+ JSRegexp notRegExp = new JSRegexp("(^|\\s)"
+ (GQUtils.truth(notTag) ? notTag.getStr(1)
: GQUtils.truth(notClass) ? notClass.getStr(1) : "")
+ "(\\s|$)", "i");
@@ -659,7 +659,7 @@ public class SelectorEngineJS extends SelectorEngineImpl {
.getStr(3).replace("\\.", "\\.") : null;
String notMatchingAttrVal = attrToRegExp(notAttribute,
notAttr.getStr(2));
- notRegExp = new Regexp(notMatchingAttrVal, "i");
+ notRegExp = new JSRegexp(notMatchingAttrVal, "i");
}
for (int v = 0, vlen = previousMatch.size(); v < vlen; v++) {
Element notElm = previousMatch.getElement(v);
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineXPath.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineXPath.java
index 57a47985..08d9f1e9 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineXPath.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineXPath.java
@@ -24,8 +24,8 @@ import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.GQUtils;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Regexp;
-import com.google.gwt.query.client.SelectorEngine;
+import com.google.gwt.query.client.JSRegexp;
+import com.google.gwt.query.client.impl.SelectorEngine;
import com.google.gwt.query.client.impl.SelectorEngineImpl;
import com.google.gwt.query.client.impl.research.SelectorEngineJS.Sequence;
import com.google.gwt.query.client.impl.research.SelectorEngineJS.SplitRule;
@@ -59,11 +59,11 @@ public class SelectorEngineXPath extends SelectorEngineImpl {
return "@" + p1 + (truth(p3) ? "='" + p3 + "'" : "");
}
- private Regexp cssSelectorRegExp;
+ private JSRegexp cssSelectorRegExp;
- private Regexp selectorSplitRegExp;
+ private JSRegexp selectorSplitRegExp;
- private Regexp combinator;
+ private JSRegexp combinator;
public SelectorEngineXPath() {
}
@@ -125,9 +125,9 @@ public class SelectorEngineXPath extends SelectorEngineImpl {
GQUtils.or(splitRule.allAttr, ""));
}
if (truth(splitRule.allPseudos)) {
- Regexp pseudoSplitRegExp = new Regexp(
+ JSRegexp pseudoSplitRegExp = new JSRegexp(
":(\\w[\\w\\-]*)(\\(([^\\)]+)\\))?");
- Regexp pseudoMatchRegExp = new Regexp(
+ JSRegexp pseudoMatchRegExp = new JSRegexp(
"(:\\w+[\\w\\-]*)(\\([^\\)]+\\))?", "g");
JSArray allPseudos = pseudoMatchRegExp.match(splitRule.allPseudos);
for (int k = 0, kl = allPseudos.size(); k < kl; k++) {
@@ -151,10 +151,10 @@ public class SelectorEngineXPath extends SelectorEngineImpl {
private void init() {
if (cssSelectorRegExp == null) {
- cssSelectorRegExp = new Regexp(
+ cssSelectorRegExp = new JSRegexp(
"^(\\w+)?(#[\\w\\u00C0-\\uFFFF\\-\\_]+|(\\*))?((\\.[\\w\\u00C0-\\uFFFF\\-_]+)*)?((\\[\\w+(\\^|\\$|\\*|\\||~)?(=[\"']*[\\w\\u00C0-\\uFFFF\\s\\-\\_\\.]+[\"']*)?\\]+)*)?(((:\\w+[\\w\\-]*)(\\((odd|even|\\-?\\d*n?((\\+|\\-)\\d+)?|[\\w\\u00C0-\\uFFFF\\-_]+|((\\w*\\.[\\w\\u00C0-\\uFFFF\\-_]+)*)?|(\\[#?\\w+(\\^|\\$|\\*|\\||~)?=?[\\w\\u00C0-\\uFFFF\\s\\-\\_\\.]+\\]+)|(:\\w+[\\w\\-]*))\\))?)*)?(>|\\+|~)?");
- selectorSplitRegExp = new Regexp("[^\\s]+", "g");
- combinator = new Regexp("(>|\\+|~)");
+ selectorSplitRegExp = new JSRegexp("[^\\s]+", "g");
+ combinator = new JSRegexp("(>|\\+|~)");
}
}
@@ -215,7 +215,7 @@ public class SelectorEngineXPath extends SelectorEngineImpl {
} else if (eq("checked", pseudoClass)) {
xpath = "@checked='checked'"; // Doesn't work in Opera 9.24
} else if (eq("not", pseudoClass)) {
- if (new Regexp("^(:\\w+[\\w\\-]*)$").test(pseudoValue)) {
+ if (new JSRegexp("^(:\\w+[\\w\\-]*)$").test(pseudoValue)) {
xpath = "not(" + pseudoToXPath(tag, pseudoValue.substring(1), "") + ")";
} else {
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java
index 61321d84..935e2f86 100755
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java
@@ -21,7 +21,6 @@ import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Plugin;
import com.google.gwt.query.client.Properties;
import com.google.gwt.query.client.plugins.ClipAnimation.Action;
import com.google.gwt.query.client.plugins.ClipAnimation.Direction;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Events.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Events.java
index d3b1cbf0..8ead39eb 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Events.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Events.java
@@ -21,7 +21,6 @@ import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Plugin;
import com.google.gwt.user.client.Event;
/**
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryQueue.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryQueue.java
index 963c070d..84798f26 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryQueue.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryQueue.java
@@ -149,6 +149,7 @@ public abstract class GQueryQueue<T extends GQueryQueue<?>> extends GQuery {
}
private void stop(Element elem, boolean clear) {
+ Function ff = null;
Queue<?> q = queue(elem, null);
if (q != null) {
Object f = q.peek();
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryUi.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryUi.java
index 84e11e9c..93c5df3b 100755
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryUi.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/GQueryUi.java
@@ -23,7 +23,6 @@ import com.google.gwt.event.shared.HasHandlers;
import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Plugin;
import com.google.gwt.query.client.Predicate;
/**
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEffects.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEffects.java
index dd4c03f5..1ec6c53c 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEffects.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEffects.java
@@ -20,7 +20,6 @@ import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Plugin;
import com.google.gwt.query.client.Properties;
import com.google.gwt.query.client.plugins.ClipAnimation.Action;
import com.google.gwt.query.client.plugins.ClipAnimation.Direction;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEvents.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEvents.java
index bf1083be..aea5dc92 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEvents.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEvents.java
@@ -20,7 +20,6 @@ import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Plugin;
import com.google.gwt.user.client.Event;
import com.google.gwt.query.client.LazyBase;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java
index c07f979d..ec5f2b44 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java
@@ -18,7 +18,6 @@ import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Plugin;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.TextBox;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Plugin.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Plugin.java
index 53e305cb..1783e6eb 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Plugin.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Plugin.java
@@ -13,7 +13,9 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.query.client;
+package com.google.gwt.query.client.plugins;
+
+import com.google.gwt.query.client.GQuery;
/**
* A GQuery plugin. All GQuery plugins must implement this interface.
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/PropertiesAnimation.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/PropertiesAnimation.java
index dfbc27b9..0fb91aef 100755
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/PropertiesAnimation.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/PropertiesAnimation.java
@@ -23,7 +23,7 @@ import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.JSArray;
import com.google.gwt.query.client.Properties;
-import com.google.gwt.query.client.Regexp;
+import com.google.gwt.query.client.JSRegexp;
/**
* Animation effects on any numeric CSS property.
@@ -70,7 +70,7 @@ public class PropertiesAnimation extends Animation {
private static final String[] attrsToSave = new String[] { "overflow",
"visibility" };
- private static Regexp nonPxRegExp = new Regexp(
+ private static JSRegexp nonPxRegExp = new JSRegexp(
"z-?index|font-?weight|opacity|zoom|line-?height", "i");
@@ -103,7 +103,7 @@ public class PropertiesAnimation extends Animation {
end = 0;
unit = nonPxRegExp.test(key) ? "" : "px";
} else {
- JSArray parts = new Regexp("^([+-]=)?([0-9+-.]+)(.*)?$").match(val);
+ JSArray parts = new JSRegexp("^([+-]=)?([0-9+-.]+)(.*)?$").match(val);
if (parts != null) {
unit = nonPxRegExp.test(key) ? "" : parts.getStr(3) == null ? "px"
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java
index 21b0fffa..ad3b2e0b 100755
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java
@@ -19,7 +19,6 @@ import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Plugin;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.TextBox;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/Widgets.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/Widgets.java
index d71f5d97..c2c260c6 100755
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/Widgets.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/Widgets.java
@@ -19,8 +19,8 @@ import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.JSArray;
-import com.google.gwt.query.client.Plugin;
import com.google.gwt.query.client.plugins.GQueryQueue;
+import com.google.gwt.query.client.plugins.Plugin;
import com.google.gwt.query.client.plugins.widgets.widgetfactory.ButtonWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.widgetfactory.TabPanelWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.widgetfactory.WidgetFactory;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/SelectorGeneratorBase.java b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/SelectorGeneratorBase.java
index 879e4cf9..8f362b54 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/SelectorGeneratorBase.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/SelectorGeneratorBase.java
@@ -137,11 +137,11 @@ public abstract class SelectorGeneratorBase extends Generator {
}
ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(
packageName, className);
- composerFactory.setSuperclass("com.google.gwt.query.client.SelectorEngine");
- composerFactory.addImport("com.google.gwt.core.client.GWT");
+ composerFactory.setSuperclass("com.google.gwt.query.client.impl.SelectorEngine");
+ composerFactory.addImport("com.google.gwt.query.client.impl.*");
+ composerFactory.addImport("com.google.gwt.query.client.Selectors.*");
composerFactory.addImport("com.google.gwt.query.client.*");
- // composerFactory.addImport("com.google.gwt.query.client.JSArray");
-
+ composerFactory.addImport("com.google.gwt.core.client.*");
composerFactory.addImport("com.google.gwt.dom.client.*");
for (String interfaceName : interfaceNames) {
composerFactory.addImplementedInterface(interfaceName);
@@ -177,9 +177,9 @@ public abstract class SelectorGeneratorBase extends Generator {
// used by benchmark harness
private void genGetAllMethod(SourceWriter sw, JMethod[] methods,
TreeLogger treeLogger) {
- sw.println("public DeferredGQuery[] getAllSelectors() {");
+ sw.println("public DeferredSelector[] getAllSelectors() {");
sw.indent();
- sw.println("DeferredGQuery[] dg = new DeferredGQuery[" + (methods.length)
+ sw.println("DeferredSelector[] ds = new DeferredSelector[" + (methods.length)
+ "];");
int i = 0;
for (JMethod m : methods) {
@@ -189,16 +189,13 @@ public abstract class SelectorGeneratorBase extends Generator {
}
String selector = selectorAnnotation.value();
- sw.println("dg[" + i + "]=new DeferredGQuery() {");
+ sw.println("ds[" + i + "]=new DeferredSelector() {");
sw.indent();
sw
.println("public String getSelector() { return \"" + selector
+ "\"; }");
- sw.println("public GQuery eval(Node ctx) { return "
- + wrapJS(m, m.getName()
- + (m.getParameters().length == 0 ? "()" : "(ctx)") + "") + " ;}");
sw
- .println("public NodeList<Element> array(Node ctx) { return "
+ .println("public NodeList<Element> runSelector(Node ctx) { return "
+ ("NodeList".equals(m.getReturnType().getSimpleSourceName()) ? (m
.getName() + (m.getParameters().length == 0 ? "(); "
: "(ctx); "))
@@ -210,7 +207,7 @@ public abstract class SelectorGeneratorBase extends Generator {
sw.outdent();
sw.println("};");
}
- sw.println("return dg;");
+ sw.println("return ds;");
sw.outdent();
sw.println("}");
}
diff --git a/samples/pom.xml b/samples/pom.xml
index 22500c00..8bab088e 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -44,8 +44,8 @@
<gwtVersion>${gwtversion}</gwtVersion>
<compileReport>true</compileReport>
<modules>
- <module>gwtquery.samples.GwtQuerySample</module>
<module>gwtquery.samples.GwtQueryBench</module>
+ <module>gwtquery.samples.GwtQuerySample</module>
<module>gwtquery.samples.GwtQueryDemo</module>
<module>gwtquery.samples.GwtQueryEffects</module>
<module>gwtquery.samples.GwtQueryEffectsMin</module>
diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java
index 8275f740..67566b1e 100644
--- a/samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java
+++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java
@@ -25,9 +25,9 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.RepeatingCommand;
import com.google.gwt.dom.client.Element;
-import com.google.gwt.query.client.DeferredGQuery;
import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.GQuery;
+import com.google.gwt.query.client.Selectors.*;
import com.google.gwt.query.client.impl.SelectorEngineCssToXPath;
import com.google.gwt.query.client.impl.SelectorEngineImpl;
import com.google.gwt.query.client.impl.SelectorEngineNative;
@@ -67,7 +67,7 @@ public class GwtQueryBenchModule implements EntryPoint {
public interface Benchmark {
String getId();
String getName();
- int runSelector(DeferredGQuery dq);
+ int runSelector(DeferredSelector dq);
}
/**
@@ -92,7 +92,7 @@ public class GwtQueryBenchModule implements EntryPoint {
return name;
}
- public int runSelector(DeferredGQuery dq) {
+ public int runSelector(DeferredSelector dq) {
return engine.select(dq.getSelector(), gwtiframe).getLength();
}
}
@@ -125,8 +125,8 @@ public class GwtQueryBenchModule implements EntryPoint {
return name;
}
- public int runSelector(DeferredGQuery dq) {
- return dq.array(gwtiframe).getLength();
+ public int runSelector(DeferredSelector dq) {
+ return dq.runSelector(gwtiframe).getLength();
}
}
@@ -148,7 +148,7 @@ public class GwtQueryBenchModule implements EntryPoint {
return id;
}
- public int runSelector(DeferredGQuery dq) {
+ public int runSelector(DeferredSelector dq) {
return runSelector(id, dq.getSelector());
}
@@ -200,7 +200,7 @@ public class GwtQueryBenchModule implements EntryPoint {
*/
private String[] defaultBenchmarks = {"gwt_compiled", "gwt_dynamic", "jquery", "prototype", "dojo"};
- private DeferredGQuery dg[];
+ private DeferredSelector ds[];
private FlexTable grid = new FlexTable();
@@ -226,7 +226,7 @@ public class GwtQueryBenchModule implements EntryPoint {
$("#startrace").text("Stop Race");
$("#results").show();
- initResultsTable(dg, selectedBenchmarks);
+ initResultsTable(ds, selectedBenchmarks);
initTrack(selectedBenchmarks);
Scheduler.get().scheduleIncremental(new RepeatingCommand() {
@@ -255,7 +255,7 @@ public class GwtQueryBenchModule implements EntryPoint {
selectorNumber++;
winner = -1;
winTime = Double.MAX_VALUE;
- if (selectorNumber >= dg.length) {
+ if (selectorNumber >= ds.length) {
double min = Double.MAX_VALUE;
for (int i = 0; i < totalTimes.length; i++) {
if (totalTimes[i] < min) {
@@ -275,7 +275,7 @@ public class GwtQueryBenchModule implements EntryPoint {
return false;
}
}
- DeferredGQuery d = dg[selectorNumber];
+ DeferredSelector d = ds[selectorNumber];
long start = System.currentTimeMillis();
int num = 0;
long end = start;
@@ -329,7 +329,7 @@ public class GwtQueryBenchModule implements EntryPoint {
final MySelectors m = GWT.create(MySelectors.class);
- dg = m.getAllSelectors();
+ ds = m.getAllSelectors();
String par = Window.Location.getParameter("min");
if (par != null) {
@@ -393,7 +393,7 @@ public class GwtQueryBenchModule implements EntryPoint {
/**
* Reset the result table
*/
- private void initResultsTable(DeferredGQuery[] dg, Benchmark... benchs) {
+ private void initResultsTable(DeferredSelector[] dg, Benchmark... benchs) {
int numRows = dg.length;
grid = new FlexTable();
grid.addStyleName("resultstable");
@@ -474,7 +474,7 @@ public class GwtQueryBenchModule implements EntryPoint {
for (double d : totalTimes) {
winnerTime = Math.min(winnerTime, d);
}
- double winnerPos = row * (double) trackWidth / (double) dg.length;
+ double winnerPos = row * (double) trackWidth / (double) ds.length;
for (int i = 0; i < b.length; i++) {
GQuery g = $("#" + b[i].getId() + "horse");
double pos = winnerPos * winnerTime / totalTimes[i];