aboutsummaryrefslogtreecommitdiffstats
path: root/gwtquery-core
diff options
context:
space:
mode:
authorRay Cromwell <cromwellian@gmail.com>2009-05-08 00:03:12 +0000
committerRay Cromwell <cromwellian@gmail.com>2009-05-08 00:03:12 +0000
commit60b8cb8b841707818511442e0cdfa008c7c344da (patch)
tree5198a6455a39bee49e8d7721994964b0d2df1db4 /gwtquery-core
parentb62d3f954fa2b0d35ec21fa5258a6f91531ab0bd (diff)
downloadgwtquery-60b8cb8b841707818511442e0cdfa008c7c344da.tar.gz
gwtquery-60b8cb8b841707818511442e0cdfa008c7c344da.zip
Seed plugins package
Diffstat (limited to 'gwtquery-core')
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Ratings.java73
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java (renamed from gwtquery-core/src/main/java/com/google/gwt/query/client/Widgets.java)7
2 files changed, 78 insertions, 2 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Ratings.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Ratings.java
new file mode 100644
index 00000000..ae0bbccd
--- /dev/null
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Ratings.java
@@ -0,0 +1,73 @@
+package com.google.gwt.query.client.plugins;
+
+import com.google.gwt.query.client.GQuery;
+import com.google.gwt.query.client.Plugin;
+import com.google.gwt.query.client.JSArray;
+import com.google.gwt.query.client.SelectorEngine;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.NodeList;
+import com.google.gwt.dom.client.InputElement;
+
+/**
+ * Star Rating plugin.
+ */
+public class Ratings extends GQuery {
+
+ /**
+ * Used to register the plugin.
+ */
+ private static class RatingsPlugin implements Plugin<Ratings> {
+
+ public Ratings init(GQuery gq) {
+ return new Ratings(gq.get());
+ }
+ }
+
+ public static final Class<Ratings> Ratings = Ratings.class;
+
+ static {
+ GQuery.registerPlugin(Ratings.class, new RatingsPlugin());
+ }
+
+ public Ratings(Element element) {
+ super(element);
+ }
+
+ public Ratings(JSArray elements) {
+ super(elements);
+ }
+
+ public Ratings(NodeList<Element> list) {
+ super(list);
+ }
+
+ public Ratings rating() {
+ if (size() == 0) {
+ return this;
+ }
+ not(".star-rating-applied").addClass("star-rating-applied");
+ Control control;
+ for (Element e : elements()) {
+ GQuery input = $(e);
+ String eid = SelectorEngine
+ .or(e.getPropertyString("name"), "unnamed-rating")
+ .replaceAll("\\[|\\]", "_").replaceAll("^\\_+|\\_$", "");
+ GQuery context = $(getContext(e));
+ Raters raters = (Raters) context.data("rating");
+ }
+
+ return this;
+ }
+
+ public static class Control {
+
+ }
+
+ public static class Raters {
+
+ }
+
+ private static native Element getContext(Element e) /*-{
+ return this.form || $doc.body;
+ }-*/;
+}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Widgets.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java
index 6fa411c5..2a981a7e 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Widgets.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java
@@ -1,13 +1,16 @@
-package com.google.gwt.query.client;
+package com.google.gwt.query.client.plugins;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.query.client.GQuery;
+import com.google.gwt.query.client.Plugin;
+import com.google.gwt.query.client.JSArray;
/**
* Experimental Gwt Query plugin for integrating Gwt Widgets.
*/
-public class Widgets extends GQuery {
+public class Widgets extends GQuery {
/**
* Used to register the plugin.
*/