]> source.dussan.org Git - gwtquery.git/commitdiff
fixed a silly issue in the demo module
authorManolo Carrasco <manolo@apache.org>
Fri, 11 Jun 2010 22:58:43 +0000 (22:58 +0000)
committerManolo Carrasco <manolo@apache.org>
Fri, 11 Jun 2010 22:58:43 +0000 (22:58 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java
samples/src/main/java/gwtquery/samples/client/GwtQueryDemoModule.java

index 8f3113ac30d27c415bf833145e57269654abebc3..efeda8c504163f8fff419cdee66247d21e09781d 100644 (file)
@@ -32,7 +32,6 @@ import com.google.gwt.dom.client.Node;
 import com.google.gwt.dom.client.NodeList;\r
 import com.google.gwt.dom.client.OptionElement;\r
 import com.google.gwt.dom.client.SelectElement;\r
-import com.google.gwt.dom.client.Style;\r
 import com.google.gwt.dom.client.TextAreaElement;\r
 import com.google.gwt.dom.client.Style.Display;\r
 import com.google.gwt.query.client.css.CssProperty;\r
index d1b12fd9b0265a0b4adea92b4dcb8062cb4609e7..8ba38829561e5fabc5432021d231f2ada32257c5 100755 (executable)
@@ -31,13 +31,13 @@ import com.google.gwt.query.client.plugins.PropertiesAnimation.Easing;
  */\r
 public class Effects extends GQueryQueue  {\r
   \r
-  public static int DEFAULT_SPEED = 400;\r
-\r
-  public static Class<Effects> Effects = Effects.class;\r
-\r
-  public static int FAST = 200;\r
-\r
-  public static int SLOW = 600;\r
+  public static class Speed {\r
+    public static final int DEFAULT = 400;\r
+    public static final int SLOW = 600;\r
+    public static final int FAST = 200;\r
+  }\r
+  \r
+  public static final Class<Effects> Effects = Effects.class;\r
   \r
   static {\r
     GQuery.registerPlugin(Effects.class, new Plugin<Effects>() {\r
@@ -137,7 +137,7 @@ public class Effects extends GQueryQueue  {
    */\r
   public Effects clip(ClipAnimation.Action a, ClipAnimation.Corner c,\r
       ClipAnimation.Direction d, Function... f) {\r
-    return clip(a, c, d, DEFAULT_SPEED, f);\r
+    return clip(a, c, d, Speed.DEFAULT, f);\r
   }\r
   \r
   /**\r
@@ -164,7 +164,7 @@ public class Effects extends GQueryQueue  {
    */\r
   public Effects clip(ClipAnimation.Action a, ClipAnimation.Corner c,\r
       Function... f) {\r
-    return clip(a, c, Direction.BIDIRECTIONAL, DEFAULT_SPEED, f);\r
+    return clip(a, c, Direction.BIDIRECTIONAL, Speed.DEFAULT, f);\r
   }\r
 \r
   /**\r
@@ -173,7 +173,7 @@ public class Effects extends GQueryQueue  {
    * The effect goes from the center to the perimeter.\r
    */\r
   public Effects clipAppear(Function... f) {\r
-    return clipAppear(DEFAULT_SPEED, f);\r
+    return clipAppear(Speed.DEFAULT, f);\r
   }\r
   \r
   /**\r
@@ -192,7 +192,7 @@ public class Effects extends GQueryQueue  {
    * The effect goes from the perimeter to the center.\r
    */\r
   public Effects clipDisappear(Function... f) {\r
-    return clipDisappear(DEFAULT_SPEED, f);\r
+    return clipDisappear(Speed.DEFAULT, f);\r
   }\r
   \r
   /**\r
@@ -211,7 +211,7 @@ public class Effects extends GQueryQueue  {
    * The effect goes from the top to the bottom.\r
    */\r
   public Effects clipDown(Function... f) {\r
-    return clipDown(DEFAULT_SPEED, f);\r
+    return clipDown(Speed.DEFAULT, f);\r
   }\r
 \r
   /**\r
@@ -230,7 +230,7 @@ public class Effects extends GQueryQueue  {
    * The effect goes from the bottom to the top.\r
    */\r
   public Effects clipUp(Function... f) {\r
-    return clipUp(DEFAULT_SPEED, f);\r
+    return clipUp(Speed.DEFAULT, f);\r
   }\r
 \r
   /**\r
@@ -250,7 +250,7 @@ public class Effects extends GQueryQueue  {
    * some form of height and width associated with them.\r
    */  \r
   public Effects fadeIn(Function... f) {\r
-    return fadeIn(DEFAULT_SPEED, f);\r
+    return fadeIn(Speed.DEFAULT, f);\r
   }\r
 \r
   /**\r
@@ -271,7 +271,7 @@ public class Effects extends GQueryQueue  {
    * them.\r
    */  \r
   public Effects fadeOut(Function... f) {\r
-    return fadeOut(DEFAULT_SPEED, f);\r
+    return fadeOut(Speed.DEFAULT, f);\r
   }\r
 \r
   /**\r
@@ -300,7 +300,7 @@ public class Effects extends GQueryQueue  {
    * optional callback after completion.\r
    */\r
   public Effects slideDown(Function... f) {\r
-    return slideDown(DEFAULT_SPEED, f);\r
+    return slideDown(Speed.DEFAULT, f);\r
   }\r
 \r
   /**\r
@@ -316,7 +316,7 @@ public class Effects extends GQueryQueue  {
    * callback after completion.\r
    */\r
   public Effects slideLeft(Function... f) {\r
-    return slideLeft(DEFAULT_SPEED, f);\r
+    return slideLeft(Speed.DEFAULT, f);\r
   }\r
 \r
   /**\r
@@ -332,7 +332,7 @@ public class Effects extends GQueryQueue  {
    * optional callback after completion.\r
    */\r
   public Effects slideRight(Function... f) {\r
-    return slideRight(DEFAULT_SPEED, f);\r
+    return slideRight(Speed.DEFAULT, f);\r
   }\r
 \r
   /**\r
@@ -358,7 +358,7 @@ public class Effects extends GQueryQueue  {
    * callback after completion.\r
    */\r
   public Effects slideUp(Function... f) {\r
-    return slideUp(DEFAULT_SPEED, f);\r
+    return slideUp(Speed.DEFAULT, f);\r
   }\r
 \r
   /**\r
@@ -374,7 +374,7 @@ public class Effects extends GQueryQueue  {
    */\r
   @Override\r
   public Effects toggle() {\r
-    return toggle(DEFAULT_SPEED);\r
+    return toggle(Speed.DEFAULT);\r
   }\r
 \r
   /**\r
index 20baa2ae2867ff6753b829aa74149480467a663d..038ee8e258b012522646140d7682c01969fed0ad 100644 (file)
@@ -1,6 +1,7 @@
 package gwtquery.samples.client;\r
 \r
 import static com.google.gwt.query.client.GQuery.$;\r
+import static com.google.gwt.query.client.plugins.Effects.Effects;\r
 \r
 import com.google.gwt.core.client.EntryPoint;\r
 import com.google.gwt.core.client.GWT;\r
@@ -11,7 +12,7 @@ import com.google.gwt.query.client.Function;
 import com.google.gwt.query.client.GQuery;\r
 import com.google.gwt.query.client.Selector;\r
 import com.google.gwt.query.client.Selectors;\r
-import com.google.gwt.query.client.plugins.Effects;\r
+import com.google.gwt.query.client.plugins.Effects.Speed;\r
 import com.google.gwt.user.client.Event;\r
 \r
 /**\r
@@ -41,7 +42,7 @@ public class GwtQueryDemoModule implements EntryPoint {
     final GQuery slides = $(s.allSlides());\r
 \r
     // we initially hide all slides and bullets\r
-    slides.hide().eq(0).as(Effects.Effects).clipAppear();\r
+    slides.hide().eq(0).as(Effects).clipAppear();\r
     $(s.allSlideBullets()).hide();\r
 \r
 \r
@@ -58,21 +59,25 @@ public class GwtQueryDemoModule implements EntryPoint {
       public boolean f(Event e) {\r
         // onclick, if not all bullets shown, show a bullet and increment\r
         if (curBullets < bullets.size()) {\r
-          bullets.eq(curBullets++).show();\r
+          bullets.eq(curBullets++).as(Effects).fadeIn(Speed.SLOW);\r
         } else {\r
           // all bullets shown, hide them and current slide\r
           bullets.hide();\r
+          \r
           // move to next slide, checking for wrap around\r
-          curSlide++;\r
+          int lastSlide = curSlide++;\r
           if (curSlide == slides.size()) {\r
             curSlide = 0;\r
           }\r
-          curBullets = 0;\r
+          \r
           // query for new set of bullets, and show next slide\r
+          curBullets = 0;\r
           bullets = $(s.slideBulletsCtx(slides.get(curSlide)));\r
-          slides.eq(curSlide - 1).as(Effects.Effects).slideLeft(new Function() {\r
+          \r
+          // Hide the last slide and show the next when the effects finishes\r
+          slides.eq(lastSlide).as(Effects).fadeOut(new Function() {\r
             public void f(Element e) {\r
-              slides.eq(curSlide).as(Effects.Effects).clipAppear();\r
+              slides.eq(curSlide).as(Effects).clipAppear();\r
             }\r
           });\r
         }\r