aboutsummaryrefslogtreecommitdiffstats
path: root/gwtquery-core
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2011-07-15 09:41:29 +0000
committerManolo Carrasco <manolo@apache.org>2011-07-15 09:41:29 +0000
commit61d8717ecf4ac52330ac83c07860e3b4cda44560 (patch)
tree30132b911f493beebd69626c2626ec1cee30f82c /gwtquery-core
parent27f613240b8286f699b8c5b3b11a46644cc085c4 (diff)
downloadgwtquery-61d8717ecf4ac52330ac83c07860e3b4cda44560.tar.gz
gwtquery-61d8717ecf4ac52330ac83c07860e3b4cda44560.zip
queue method should return the number of elements in the queue if no functions are proviced like jquery does
Diffstat (limited to 'gwtquery-core')
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java17
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java12
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/QueuePlugin.java7
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/SimpleNamedQueue.java8
4 files changed, 42 insertions, 2 deletions
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 e58250cf..38b4472a 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
@@ -2966,7 +2966,22 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
return this;
}
-
+
+ /**
+ * Show the number of functions in the efects queue to be executed on the
+ * first matched element.
+ */
+ public int queue() {
+ return as(Effects).queue();
+ }
+
+ /**
+ * Show the number of functions in the queued named as queueName to be
+ * executed on the first matched element.
+ */
+ public int queue(String queueName) {
+ return as(SimpleNamedQueue).queue();
+ }
/**
* Put a set of {@link Function} at the end of the Effects queue.
*
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
index 84753e54..2abdcde2 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
@@ -1686,6 +1686,18 @@ public interface LazyGQuery<T> extends LazyBase<T>{
LazyGQuery<T> prop(String key, Function closure);
/**
+ * Show the number of functions in the efects queue to be executed on the
+ * first matched element.
+ */
+ int queue();
+
+ /**
+ * Show the number of functions in the queued named as queueName to be
+ * executed on the first matched element.
+ */
+ int queue(String queueName);
+
+ /**
* Put a set of {@link Function} at the end of the Effects queue.
*
* Example:
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/QueuePlugin.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/QueuePlugin.java
index e4f1be98..a74848b5 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/QueuePlugin.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/QueuePlugin.java
@@ -94,6 +94,13 @@ public abstract class QueuePlugin<T extends QueuePlugin<?>> extends GQuery {
}
return (T) this;
}
+
+ /**
+ * Show the number of functions to be executed on the first matched element.
+ */
+ public int queue() {
+ return isEmpty() ? 0 : queue(get(0), null).size();
+ }
/**
* Adds new functions, to be executed, onto the end of the queue of all
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/SimpleNamedQueue.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/SimpleNamedQueue.java
index 823ce857..00073555 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/SimpleNamedQueue.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/SimpleNamedQueue.java
@@ -20,7 +20,13 @@ public class SimpleNamedQueue extends QueuePlugin<SimpleNamedQueue>{
}
private String queueName;
-
+
+ @Override
+ public int queue(String queueName) {
+ this.queueName = queueName;
+ return queue();
+ }
+
@Override
public SimpleNamedQueue delay(int milliseconds, String queueName, Function... f) {
this.queueName = queueName;