diff options
author | Julien Dramaix <julien.dramaix@gmail.com> | 2011-04-28 16:30:19 +0000 |
---|---|---|
committer | Julien Dramaix <julien.dramaix@gmail.com> | 2011-04-28 16:30:19 +0000 |
commit | da588e2f8245049590daf6f3025e6aa7e2086b9d (patch) | |
tree | e4a0e11d1dcb9cc2f74f93b2ef43881aa96f5bba /samples/src/main/java | |
parent | f6e5ba81422e0b4aafada9c1e993e7b57003e39e (diff) | |
download | gwtquery-da588e2f8245049590daf6f3025e6aa7e2086b9d.tar.gz gwtquery-da588e2f8245049590daf6f3025e6aa7e2086b9d.zip |
proposal for home page sample
Diffstat (limited to 'samples/src/main/java')
3 files changed, 108 insertions, 0 deletions
diff --git a/samples/src/main/java/gwtquery/samples/HomePageSample.gwt.xml b/samples/src/main/java/gwtquery/samples/HomePageSample.gwt.xml new file mode 100644 index 00000000..429b0f07 --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/HomePageSample.gwt.xml @@ -0,0 +1,7 @@ +<module rename-to='HomePageSample'> + <inherits name='com.google.gwt.query.Query' /> + <entry-point + class="gwtquery.samples.client.HomePageSample"> + </entry-point> +</module> + diff --git a/samples/src/main/java/gwtquery/samples/client/HomePageSample.java b/samples/src/main/java/gwtquery/samples/client/HomePageSample.java new file mode 100644 index 00000000..a66f057b --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/client/HomePageSample.java @@ -0,0 +1,47 @@ +/* + * Copyright 2011, The gwtquery team. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package gwtquery.samples.client; + +import static com.google.gwt.query.client.GQuery.$; +import static com.google.gwt.query.client.plugins.Effects.Effects; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.query.client.Function; +import com.google.gwt.query.client.css.CSS; +import com.google.gwt.query.client.css.Length; + +public class HomePageSample implements EntryPoint { + + + public void onModuleLoad() { + //Hide the text and set the width and append an h1 element + $("#text").hide().css(CSS.WIDTH.with(Length.px(400))).prepend("<h1>GwtQuery Rocks !</h1>"); + + //add a click handler on the button + $("button").click(new Function(){ + + public void f() { + $("#text").as(Effects) + .clipDown() + .animate("backgroundColor: 'yellow'", 500) + .delay(1000) + .animate("backgroundColor: '#fff'", 1500); + } + + }); + } + +} diff --git a/samples/src/main/java/gwtquery/samples/public/HomePageSample.html b/samples/src/main/java/gwtquery/samples/public/HomePageSample.html new file mode 100644 index 00000000..a3dcfdec --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/public/HomePageSample.html @@ -0,0 +1,54 @@ +<!doctype html> +<html> +<head> +<title>GQuery</title> +<script language="javascript" src="HomePageSample.nocache.js"></script> +<style type="text/css"> +.reset { + float: left; +} + +.foo { + border: 1px solid black; +} +</style> +</head> +<body> +<p>Java Code :</p> +<pre> + public void onModuleLoad() { + //Hide the text and set the width and append an h1 element + $("#text").hide().css(CSS.WIDTH.with(Length.px(400))).prepend("<h1>GwtQuery Rocks !</h1>"); + + //add a click handler on the button + $("button").click(new Function(){ + + public void f() { + $("#text").as(Effects) + .clipDown() + .animate("backgroundColor: 'yellow'", 500) + .delay(1000) + .animate("backgroundColor: '#fff'", 1500); + } + + }); + } +</pre> +<button>Click Me</button> +<div id="text">Lorem ipsum dolor sit amet, consectetur adipiscing +elit. Maecenas ac ultricies lorem. Integer erat nibh, semper eget +tincidunt non, egestas ac augue. Aliquam dapibus pharetra rhoncus. +Integer adipiscing mauris ullamcorper mauris dictum eu luctus tortor +consequat. Nam quis tortor diam, laoreet aliquam enim. Vivamus turpis +arcu, varius eu consectetur vitae, luctus ut sapien. Donec vel sem +metus, ac mattis est. Nulla facilisi. Etiam pharetra tortor aliquam eros +sagittis sit amet dignissim diam pellentesque. Vivamus lobortis varius +leo, eu pharetra sapien rhoncus vitae. Aliquam fermentum nulla et elit +vestibulum et sagittis leo faucibus. Etiam gravida felis a sapien luctus +tincidunt. Quisque non purus ut massa ultrices scelerisque. Donec vel +risus est, quis tempus est. Integer commodo feugiat ornare. Pellentesque +pretium eleifend dui sit amet accumsan. Mauris vulputate rhoncus turpis +vitae scelerisque. Nulla lobortis, nulla ut porttitor condimentum, lacus +ligula scelerisque tortor, et eleifend arcu risus non massa.</div> +</body> +</html>
\ No newline at end of file |