From 58863c69fcf5951ebda6b83ca8ec746d4c25a9a4 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Sun, 17 Jul 2011 16:13:49 +0000 Subject: [PATCH] Fix getQueueType which was failing when extending Effects because of the classname --- .../com/google/gwt/query/client/GQuery.java | 18 ------------------ .../gwt/query/client/plugins/Effects.java | 5 +++++ .../gwt/query/client/plugins/QueuePlugin.java | 15 +++++++-------- 3 files changed, 12 insertions(+), 26 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 a11e20a6..7ef58ec5 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 @@ -1039,10 +1039,6 @@ public class GQuery implements Lazy { * Remove from the queue all {@link Function} that have not yet been run. */ public GQuery clearQueue(String queueName) { - if (queueName == null || "fx".equalsIgnoreCase(queueName)) { - return as(Effects).clearQueue(); - } - return as(SimpleNamedQueue).clearQueue(queueName); } @@ -1464,10 +1460,6 @@ public class GQuery implements Lazy { * */ public GQuery delay(int milliseconds, String queueName, Function... f) { - if (queueName == null || "fx".equalsIgnoreCase(queueName)) { - return as(Effects).delay(milliseconds, f); - } - return as(SimpleNamedQueue).delay(milliseconds, queueName, f); } @@ -1663,10 +1655,6 @@ public class GQuery implements Lazy { * */ public GQuery dequeue(String queueName) { - if (queueName == null || "fx".equalsIgnoreCase(queueName)) { - return as(Effects).dequeue(); - } - return as(SimpleNamedQueue).dequeue(queueName); } @@ -2955,11 +2943,8 @@ public class GQuery implements Lazy { assert closure != null : "Closure is null"; int i = 0; - for (Element e : elements) { - Object value = closure.f(e, i++); - if (value != null) { e.setPropertyBoolean(key, value instanceof Boolean ? (Boolean) value : Boolean.valueOf(value.toString())); @@ -3039,9 +3024,6 @@ public class GQuery implements Lazy { * {@see #dequeue()} */ public GQuery queue(String queueName, Function... f) { - if (queueName == null || "fx".equalsIgnoreCase(queueName)) { - return as(Effects).queue(f); - } return as(SimpleNamedQueue).queue(queueName, f); } 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 201a6cf1..d223b0cc 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 @@ -583,4 +583,9 @@ public class Effects extends QueuePlugin { return animate("opacity: 'toggle', width : 'toggle', height : 'toggle'", millisecs, f); } + + @Override + protected String getQueueType() { + return super.getQueueType() + "fx"; + } } 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 bf090305..07b56bee 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 @@ -55,9 +55,8 @@ public abstract class QueuePlugin> extends GQuery { } } - public static final String JUMP_TO_END = "com.google.gwt.query.client.plugins.QueuePlugin.StopData"; - private static final String QUEUE_DATA_PREFIX = "GQueryQueue_"; - + public static final String JUMP_TO_END = QueuePlugin.class.getName() + ".StopData"; + protected static final String QUEUE_DATA_PREFIX = QueuePlugin.class.getName() + ".Queue-"; protected QueuePlugin(GQuery gq) { super(gq); @@ -158,7 +157,7 @@ public abstract class QueuePlugin> extends GQuery { } protected String getQueueType() { - return QUEUE_DATA_PREFIX + this.getClass().getName(); + return QUEUE_DATA_PREFIX; } private void dequeueCurrentAndRunNext(Element elem) { @@ -185,10 +184,10 @@ public abstract class QueuePlugin> extends GQuery { } if (func != null) { q.add(func); - } - if (q.size() == 1 && func != null) { - if (func instanceof Function) { - ((Function) func).f(elem.cast()); + if (q.size() == 1) { + if (func instanceof Function) { + ((Function) func).f(elem.cast()); + } } } return q; -- 2.39.5