From: Manolo Carrasco Date: Thu, 6 May 2010 14:11:05 +0000 (+0000) Subject: fixed examples X-Git-Tag: release-1.3.2~745 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ef0f3f7aa87982468dbe0790f8c5ccc1bd0db047;p=gwtquery.git fixed examples --- diff --git a/samples/src/main/java/gwtquery/samples/GwtQuerySample.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQuerySample.gwt.xml index 86077f47..344d7a6b 100644 --- a/samples/src/main/java/gwtquery/samples/GwtQuerySample.gwt.xml +++ b/samples/src/main/java/gwtquery/samples/GwtQuerySample.gwt.xml @@ -1,7 +1,7 @@ - + diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryDemoModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryDemoModule.java index 90934a57..ac2679df 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQueryDemoModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryDemoModule.java @@ -1,5 +1,8 @@ package gwtquery.samples.client; +import static com.google.gwt.query.client.Effects.Effects; +import static com.google.gwt.query.client.GQuery.$; + import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Document; @@ -8,7 +11,6 @@ import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.NodeList; import com.google.gwt.query.client.Function; import com.google.gwt.query.client.GQuery; -import static com.google.gwt.query.client.GQuery.$; import com.google.gwt.query.client.Selector; import com.google.gwt.query.client.Selectors; import com.google.gwt.user.client.Event; @@ -48,25 +50,19 @@ public class GwtQueryDemoModule implements EntryPoint { // two state variables to note current slide being shown // and current bullet int curSlide = 0; - int curBullets = 0; // query and store all slides, and bullets of current slide GQuery slides = $(s.allSlides()); - GQuery bullets = $(s.slideBulletsCtx(slides.get(curSlide))); - public boolean f(Event e) { // onclick, if not all bullets shown, show a bullet and increment if (curBullets < bullets.size()) { - bullets.eq(curBullets++).show(); + bullets.eq(curBullets++).fadeIn(); } else { // all bullets shown, hide them and current slide -// bullets.css("opacity","0"); bullets.hide(); - slides.eq(curSlide).hide(); - -// slides.eq(curSlide).css("display", "none"); + slides.eq(curSlide).as(Effects).hide(); // move to next slide, checking for wrap around curSlide++; if (curSlide == slides.size()) { @@ -74,7 +70,6 @@ public class GwtQueryDemoModule implements EntryPoint { } curBullets = 0; // query for new set of bullets, and show next slide - // by changing opacity to 1 and display to block bullets = $(s.slideBulletsCtx(slides.get(curSlide))); slides.eq(curSlide).show(); } diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java index 3bfaa077..ce237220 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java @@ -1,23 +1,27 @@ package gwtquery.samples.client; +import static com.google.gwt.query.client.GQuery.lazy; + import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.query.client.GQuery; import com.google.gwt.query.client.Selector; import com.google.gwt.query.client.Selectors; - public class GwtQuerySampleModule implements EntryPoint { public interface Sample extends Selectors { - @Selector(".note") GQuery allNotes(); - } public void onModuleLoad() { Sample s = GWT.create(Sample.class); - s.allNotes().text("Hello Google I/O"); + s.allNotes().text("Hello Google I/O"). + css("cursor", "pointer"). + toggle( + lazy().css("color", "red").done(), + lazy().css("color", "").done() + ); } } diff --git a/samples/src/main/java/gwtquery/samples/public/GwtQueryDemo.html b/samples/src/main/java/gwtquery/samples/public/GwtQueryDemo.html index 6e049cf4..3dc9ce08 100644 --- a/samples/src/main/java/gwtquery/samples/public/GwtQueryDemo.html +++ b/samples/src/main/java/gwtquery/samples/public/GwtQueryDemo.html @@ -8,17 +8,12 @@ border: 1px solid black; width: 800px; height: 600px; - display: none } - .slide { - background: -webkit-gradient(linear, left top, left bottom, from(#000000), to(#808080), color-stop(0.9, #808080)); - -webkit-background-origin: padding-box; - -webkit-background-clip: content-box; + background-color: #505050; } - .slide, .slide * { - color: white; + color: #ffffff; font-size: 150%; }