diff options
author | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2013-11-11 08:42:10 +0100 |
---|---|---|
committer | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2013-11-11 08:42:10 +0100 |
commit | 9b5ecde687f8f98abdaf0984b2d4a06fa60dd478 (patch) | |
tree | 23098ee9f58598118ac2ebd42b8988d0cbfa25cc | |
parent | e163e1e2d681c4111ae14843fa61356038032fbf (diff) | |
download | gwtquery-9b5ecde687f8f98abdaf0984b2d4a06fa60dd478.tar.gz gwtquery-9b5ecde687f8f98abdaf0984b2d4a06fa60dd478.zip |
Some refactoring in GQuery Animation classes, to reuse code from super classes
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<Effects> { // 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; @@ -103,16 +102,6 @@ public class ClipAnimation extends PropertiesAnimation { } @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(); if (currentAction == Action.HIDE) { @@ -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<Fx> 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; /** |