]> source.dussan.org Git - gwtquery.git/commitdiff
Some refactoring in GQuery Animation classes, to reuse code from super classes
authorManuel Carrasco Moñino <manuel.carrasco.m@gmail.com>
Mon, 11 Nov 2013 07:42:10 +0000 (08:42 +0100)
committerManuel Carrasco Moñino <manuel.carrasco.m@gmail.com>
Mon, 11 Nov 2013 07:42:10 +0000 (08:42 +0100)
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/ClipAnimation.java
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/PropertiesAnimation.java
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/TransitionsAnimation.java

index d8b07659f28bba6906d73e4fde9cbf57306dbe2e..39d792dd4bd78f0d2a837f4176912ae1c53bc2ec 100755 (executable)
@@ -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);
index c22631a03be0faa73708b5839923b765000f1d90..2f928284969b470bbab102a7749006b2779c278e 100755 (executable)
@@ -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
index 8640008108d4bbf686d3076ea7f9c771a2ec5613..36c5ddc8d10385de7f0efa81d33a499175bb3749 100755 (executable)
@@ -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);
   }
 
index 12935f78e73fb07a92e063953f6fae141ce0a3c2..32e689d7a8dad60b55f4e683e6ee7c27a42ad2a4 100755 (executable)
@@ -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;
 
 /**