From 9b5ecde687f8f98abdaf0984b2d4a06fa60dd478 Mon Sep 17 00:00:00 2001 From: Manuel Carrasco MoƱino Date: Mon, 11 Nov 2013 08:42:10 +0100 Subject: Some refactoring in GQuery Animation classes, to reuse code from super classes --- .../java/com/google/gwt/query/client/plugins/Effects.java | 11 ++++++++++- .../gwt/query/client/plugins/effects/ClipAnimation.java | 13 ------------- .../query/client/plugins/effects/PropertiesAnimation.java | 6 +++--- .../query/client/plugins/effects/TransitionsAnimation.java | 1 - 4 files changed, 13 insertions(+), 18 deletions(-) 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 d8b07659..39d792dd 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 @@ -42,7 +42,16 @@ public class Effects extends QueuePlugin { // Each Animation is associated to one element protected Element e; - + protected Properties prps; + + protected GQAnimation setElement(Element element) { + e = element; + return this; + } + protected GQAnimation setProperties(Properties properties) { + prps = properties; + return this; + } protected void onStart() { // Mark this animation as actual, so as we can stop it in the GQuery.stop() method $(e).data(ACTUAL_ANIMATION, this); diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/ClipAnimation.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/ClipAnimation.java index c22631a0..2f928284 100755 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/ClipAnimation.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/ClipAnimation.java @@ -56,7 +56,6 @@ public class ClipAnimation extends PropertiesAnimation { private Corner corner; private Direction direction; private GQuery back = Effects.$(); - private Function[] funcs; private Effects g; private Action currentAction; @@ -102,16 +101,6 @@ public class ClipAnimation extends PropertiesAnimation { this(elem, a, c, d, null, Properties.create(), funcs); } - @Override - public void onCancel() { - Boolean jumpToEnd = Effects.$(e).data(Effects.JUMP_TO_END, Boolean.class); - if (jumpToEnd != null && jumpToEnd){ - onComplete(); - } else { - g.dequeue(); - } - } - @Override public void onComplete() { super.onComplete(); @@ -122,8 +111,6 @@ public class ClipAnimation extends PropertiesAnimation { back.remove(); back = Effects.$(); g.css("clip", ""); - g.each(funcs); - g.dequeue(); } @Override diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java index 86400081..36c5ddc8 100755 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java @@ -271,7 +271,6 @@ public class PropertiesAnimation extends GQAnimation { protected Easing easing; protected JsObjectArray effects; protected Function[] funcs; - protected Properties prps; private Effects g; public PropertiesAnimation(Element elem, Properties p, Function... funcs) { @@ -287,9 +286,10 @@ public class PropertiesAnimation extends GQAnimation { } } this.easing = easing; - this.e = elem; this.funcs = funcs; - this.prps = p; + setProperties(p); + setElement(elem); + g = $(e).as(Effects.Effects); } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/TransitionsAnimation.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/TransitionsAnimation.java index 12935f78..32e689d7 100755 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/TransitionsAnimation.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/TransitionsAnimation.java @@ -22,7 +22,6 @@ import com.google.gwt.query.client.Function; import com.google.gwt.query.client.Properties; import com.google.gwt.query.client.js.JsObjectArray; import com.google.gwt.query.client.plugins.effects.Fx.TransitFx; -import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.EasingCurve; import com.google.gwt.regexp.shared.MatchResult; /** -- cgit v1.2.3