From eabe26078b19afcd94b45b9b7e950448054b6c1e Mon Sep 17 00:00:00 2001 From: Ray Cromwell Date: Thu, 28 May 2009 18:36:55 +0000 Subject: Final tweaks for Google I/O. After this, I promise higher quality commit comments. --- samples/pom.xml | 178 +++++++++++---------- .../java/gwtquery/samples/GwtQueryEffects.gwt.xml | 7 + .../java/gwtquery/samples/GwtQueryPlugin.gwt.xml | 7 + .../java/gwtquery/samples/GwtQueryWidgets.gwt.xml | 7 + .../samples/client/GwtQueryDemoModule.java | 21 ++- .../samples/client/GwtQueryEffectsModule.java | 41 +++++ .../samples/client/GwtQueryPluginModule.java | 35 ++++ .../samples/client/GwtQuerySampleModule.java | 55 ++----- .../samples/client/GwtQueryWidgetModule.java | 33 ++++ .../gwtquery/samples/public/GwtQueryBench.html | 8 +- .../java/gwtquery/samples/public/GwtQueryDemo.html | 18 ++- .../gwtquery/samples/public/GwtQueryEffects.html | 23 +++ .../gwtquery/samples/public/GwtQueryPlugin.html | 174 ++++++++++++++++++++ .../gwtquery/samples/public/GwtQuerySample.html | 176 +------------------- .../gwtquery/samples/public/GwtQueryWidgets.html | 21 +++ .../gwtquery/samples/public/dojo-logo-text.gif | Bin 0 -> 459 bytes .../java/gwtquery/samples/public/gwt-logo-cs.gif | Bin 0 -> 2645 bytes .../main/java/gwtquery/samples/public/horse.gif | Bin 0 -> 16064 bytes .../java/gwtquery/samples/public/logo_jquery.gif | Bin 0 -> 2179 bytes .../gwtquery/samples/public/prototype_logo.gif | Bin 0 -> 2659 bytes .../java/gwtquery/samples/public/racetrack.html | 10 +- 21 files changed, 495 insertions(+), 319 deletions(-) create mode 100644 samples/src/main/java/gwtquery/samples/GwtQueryEffects.gwt.xml create mode 100644 samples/src/main/java/gwtquery/samples/GwtQueryPlugin.gwt.xml create mode 100644 samples/src/main/java/gwtquery/samples/GwtQueryWidgets.gwt.xml create mode 100644 samples/src/main/java/gwtquery/samples/client/GwtQueryEffectsModule.java create mode 100644 samples/src/main/java/gwtquery/samples/client/GwtQueryPluginModule.java create mode 100644 samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java create mode 100644 samples/src/main/java/gwtquery/samples/public/GwtQueryEffects.html create mode 100644 samples/src/main/java/gwtquery/samples/public/GwtQueryPlugin.html create mode 100644 samples/src/main/java/gwtquery/samples/public/GwtQueryWidgets.html create mode 100644 samples/src/main/java/gwtquery/samples/public/dojo-logo-text.gif create mode 100644 samples/src/main/java/gwtquery/samples/public/gwt-logo-cs.gif create mode 100644 samples/src/main/java/gwtquery/samples/public/horse.gif create mode 100644 samples/src/main/java/gwtquery/samples/public/logo_jquery.gif create mode 100644 samples/src/main/java/gwtquery/samples/public/prototype_logo.gif (limited to 'samples') diff --git a/samples/pom.xml b/samples/pom.xml index 4813f3ae..00fc33b0 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -1,86 +1,100 @@ - - 4.0.0 - - com.google.gwt - gwtquery-project - 1.0-SNAPSHOT - + + 4.0.0 + + com.google.gwt + gwtquery-project + 1.0-SNAPSHOT + - GwtQuery Samples - gwtquery-samples - jar - - - ${groupId} - gwtquery - ${version} - jar - + GwtQuery Samples + gwtquery-samples + jar + + + ${groupId} + gwtquery + ${version} + jar + - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack - compile - - unpack - - - - - com.google.gwt - gwt-dev - ${gwtversion} - ${gwtplatform}-libs - zip - true - - ${settings.localRepository}/com/google/gwt/gwt-dev/${gwtversion} - - - - - - - - - com.totsp.gwt - maven-googlewebtoolkit2-plugin - 2.0-beta24 - - ${gwtversion} - WARN - - gwtquery.samples.GwtQueryDemo/index.html - - - - gwtquery.samples.GwtQueryDemo - - - gwtquery.samples.GwtQueryBench - - - gwtquery.samples.GwtQuerySample - - - - - - - compilegwt - - compile - - - - - - + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + compile + + unpack + + + + + com.google.gwt + gwt-dev + ${gwtversion} + ${gwtplatform}-libs + zip + true + + ${settings.localRepository}/com/google/gwt/gwt-dev/${gwtversion} + + + + + + + + + com.totsp.gwt + maven-googlewebtoolkit2-plugin + 2.0-beta24 + + ${gwt.loglevel} + + ${gwtversion} + + WARN + + gwtquery.samples.GwtQueryDemo/index.html + + + + gwtquery.samples.GwtQueryDemo + + + gwtquery.samples.GwtQueryBench + + + gwtquery.samples.GwtQuerySample + + + gwtquery.samples.GwtQueryPlugin + + + gwtquery.samples.GwtQueryWidgets + + + gwtquery.samples.GwtQueryEffects + + + + + + + compilegwt + + compile + + + + + + diff --git a/samples/src/main/java/gwtquery/samples/GwtQueryEffects.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQueryEffects.gwt.xml new file mode 100644 index 00000000..a8f1ad41 --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/GwtQueryEffects.gwt.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/samples/src/main/java/gwtquery/samples/GwtQueryPlugin.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQueryPlugin.gwt.xml new file mode 100644 index 00000000..e2254211 --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/GwtQueryPlugin.gwt.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/samples/src/main/java/gwtquery/samples/GwtQueryWidgets.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQueryWidgets.gwt.xml new file mode 100644 index 00000000..cecae267 --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/GwtQueryWidgets.gwt.xml @@ -0,0 +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 3753c25c..2c0b5fc5 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQueryDemoModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryDemoModule.java @@ -39,14 +39,10 @@ public class GwtQueryDemoModule implements EntryPoint { // Ask GWT compiler to generate our interface final Slide s = GWT.create(Slide.class); - // Find all slides, set css to display: none - // change first slide to display: block - $(s.allSlides()).css("display", "none") - .eq(0).css("display", "block"); + $(s.allSlides()).hide().eq(0).show(); - - // we initially hide all bullets by setting opacity to 0 - $(s.allSlideBullets()).css("opacity", "0"); + // we initially hide all bullets + $(s.allSlideBullets()).hide(); // add onclick handler to body element $(Document.get().getBody()).click(new Function() { @@ -62,11 +58,14 @@ public class GwtQueryDemoModule implements EntryPoint { public boolean f(Event e) { // onclick, if not all bullets shown, show a bullet and increment if (curBullets < bullets.size()) { - bullets.eq(curBullets++).as(Effects).fadeIn(); + bullets.eq(curBullets++).show(); } else { // all bullets shown, hide them and current slide - bullets.css("opacity","0"); - slides.eq(curSlide).css("display", "none"); +// bullets.css("opacity","0"); + bullets.hide(); + slides.eq(curSlide).hide(); + +// slides.eq(curSlide).css("display", "none"); // move to next slide, checking for wrap around curSlide++; if(curSlide == slides.size()) { @@ -76,7 +75,7 @@ public class GwtQueryDemoModule implements EntryPoint { // 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).css("display", "block").as(Effects).fadeIn(); + slides.eq(curSlide).show(); } return true; } diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryEffectsModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryEffectsModule.java new file mode 100644 index 00000000..26626faf --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryEffectsModule.java @@ -0,0 +1,41 @@ +package gwtquery.samples.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.query.client.Effects; +import com.google.gwt.query.client.Function; +import static com.google.gwt.query.client.Effects.Effects; +import static com.google.gwt.query.client.Effects.Easing.*; +import static com.google.gwt.query.client.GQuery.$; +import static com.google.gwt.query.client.GQuery.$$; +import static com.google.gwt.query.client.GQuery.lazy; +import com.google.gwt.user.client.Event; + + +public class GwtQueryEffectsModule implements EntryPoint { + + public void onModuleLoad() { + + $("div > div"). + css("color", "blue"). + hover(lazy(). + css("color", "red"). + done(), lazy(). + css("color", "blue"). + done()); + + + $("div.outer > div").css("position", "relative").dblclick(new Function() { + public boolean f(Event e) { + $("div.outer > div").as(Effects). + animate($$("left: '+=100'"), 400, LINEAR, null). + animate($$("top: '+=100'"), 400, LINEAR, null). + animate($$("left: '-=100'"), 400, LINEAR, null). + animate($$("top: '-=100'"), 400, LINEAR, null); + + return true; + } + }); + $(".note").click(lazy().fadeOut().done()); + $(".note").append(" Hello"); + } +} \ No newline at end of file diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryPluginModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryPluginModule.java new file mode 100644 index 00000000..8b965163 --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryPluginModule.java @@ -0,0 +1,35 @@ +package gwtquery.samples.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.query.client.Function; +import static com.google.gwt.query.client.GQuery.$; +import com.google.gwt.query.client.plugins.Ratings; +import com.google.gwt.query.client.plugins.Widgets; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.Window; + + +public class GwtQueryPluginModule implements EntryPoint { + + public void onModuleLoad() { + + $(".outer").eq(0).after(""); + $("#enhance").one(Event.ONCLICK, null, new Function() { + @Override + public boolean f(Event e) { + $(e).attr("disabled", "true"); + $("input").as(Ratings.Ratings).rating(); + return true; + } + }); + $(".btn:nth-child(odd)").as(Widgets.Widgets).button() + .addClickHandler(new ClickHandler() { + public void onClick(ClickEvent clickEvent) { + Window.alert("You Clicked the Button"); + } + }).end(); + + } +} \ No newline at end of file diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java index 7a8f20c0..93fe3687 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java @@ -1,57 +1,26 @@ package gwtquery.samples.client; import com.google.gwt.core.client.EntryPoint; -import com.google.gwt.query.client.Effects; -import com.google.gwt.query.client.Function; +import com.google.gwt.core.client.GWT; import com.google.gwt.query.client.GQuery; -import com.google.gwt.query.client.plugins.Ratings; import static com.google.gwt.query.client.GQuery.$; -import static com.google.gwt.query.client.GQuery.$$; -import static com.google.gwt.query.client.GQuery.lazy; -import com.google.gwt.user.client.Event; +import com.google.gwt.query.client.Selector; +import com.google.gwt.query.client.Selectors; +import static com.google.gwt.query.client.css.CSS.TOP; +import static com.google.gwt.query.client.css.CSS.VERTICAL_ALIGN; public class GwtQuerySampleModule implements EntryPoint { -// public interface Sample extends Selectors { -// @Selector(".note") -// GQuery allNotes(); - // } + public interface Sample extends Selectors { - public void onModuleLoad() { - GQuery q = $(".note"); - - $("div > div"). - css("color", "blue"). - hover( - lazy(). - css("color", "red"). - done(), - lazy(). - css("color", "blue"). - done()); - $("div.outer > div").css("position", "relative").dblclick(new Function() { - public boolean f(Event e) { - $("div.outer > div").as(Effects.Effects). - animate($$("left: '+=100'"), 400, Effects.Easing.LINEAR, null). - animate($$("top: '+=100'"), 400, Effects.Easing.LINEAR, null). - animate($$("left: '-=100'"), 400, Effects.Easing.LINEAR, null). - animate($$("top: '-=100'"), 400, Effects.Easing.LINEAR, null); + @Selector(".note") + GQuery allNotes(); - return true; - } - }); - $(".note").click(lazy().fadeOut().done()); - $(".note").append(" Hello"); - $(".outer").eq(0).after(""); - $("#enhance").one(Event.ONCLICK, null, new Function() { - @Override - public boolean f(Event e) { - $(e).attr("disabled", "true"); - $("input").as(Ratings.Ratings).rating(); - return true; - } - }); + } + public void onModuleLoad() { + Sample s = GWT.create(Sample.class); + s.allNotes().text("Hello Google I/O"); } } diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java new file mode 100644 index 00000000..9264deda --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java @@ -0,0 +1,33 @@ +package gwtquery.samples.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.query.client.Function; +import static com.google.gwt.query.client.GQuery.$; +import com.google.gwt.query.client.plugins.Widgets; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.Window; + + +public class GwtQueryWidgetModule implements EntryPoint { + + public void onModuleLoad() { + + $(".outer").eq(0).after(""); + $("#enhance").one(Event.ONCLICK, null, new Function() { + @Override + public boolean f(Event e) { + $(".btn:nth-child(odd)").as(Widgets.Widgets).button().label("Foo") + .addClickHandler(new ClickHandler() { + public void onClick(ClickEvent clickEvent) { + Window.alert("You Clicked the Button"); + } + }).end(); + + return true; + } + }); + + } +} \ No newline at end of file diff --git a/samples/src/main/java/gwtquery/samples/public/GwtQueryBench.html b/samples/src/main/java/gwtquery/samples/public/GwtQueryBench.html index 44e930e3..623053b1 100644 --- a/samples/src/main/java/gwtquery/samples/public/GwtQueryBench.html +++ b/samples/src/main/java/gwtquery/samples/public/GwtQueryBench.html @@ -43,6 +43,7 @@ background-color: black; color: white } + @@ -54,11 +55,12 @@ - - + +
+
-
+