diff options
author | Manolo Carrasco <manolo@apache.org> | 2011-04-19 07:22:52 +0000 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2011-04-19 07:22:52 +0000 |
commit | 99c595608e0b17561366234fa2bb4a621857697b (patch) | |
tree | b356fe82d7207e56aa60c3d472b8e39f5d2a9ba4 /samples | |
parent | cf4f6348162b6f4c7f7dfa79064bfa6d062b81f6 (diff) | |
download | gwtquery-99c595608e0b17561366234fa2bb4a621857697b.tar.gz gwtquery-99c595608e0b17561366234fa2bb4a621857697b.zip |
widgets plugin has a just set of basic factories, the rest will be in the enhance plugin or others
Diffstat (limited to 'samples')
-rw-r--r-- | samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java | 30 | ||||
-rw-r--r-- | samples/src/main/java/gwtquery/samples/public/GwtQuerySample.html | 48 |
2 files changed, 66 insertions, 12 deletions
diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java index c72f7f50..581d34ae 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java @@ -18,16 +18,23 @@ package gwtquery.samples.client; import static com.google.gwt.query.client.GQuery.$;
import static com.google.gwt.query.client.GQuery.document;
import static com.google.gwt.query.client.GQuery.lazy;
+import static com.google.gwt.query.client.plugins.Widgets.Widgets;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Cursor;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.Selector;
import com.google.gwt.query.client.Selectors;
import com.google.gwt.query.client.css.CSS;
import com.google.gwt.query.client.css.RGBColor;
+import com.google.gwt.query.client.plugins.widgets.WidgetInitializer;
import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Label;
public class GwtQuerySampleModule implements EntryPoint {
@@ -47,8 +54,27 @@ public class GwtQuerySampleModule implements EntryPoint { lazy().css(CSS.COLOR.with(RGBColor.RED)).done(),
lazy().css(CSS.COLOR.with(null)).done()
);
-
// Cascade effects
$("<div id='id' style='font-size: 150%;'>Cascade Efects</div>").appendTo(document).hide().fadeIn(5000).fadeOut(3000);
+
+ // Widgets
+ $(".btn").as(Widgets).button(new WidgetInitializer<Button>() {
+ public void initialize(Button button, Element e) {
+ final String tag = e.getTagName();
+ button.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ Window.alert("You click on a GWT Button created from a " + tag);
+ }
+ });
+ }
+ });
+ $(".inputText").as(Widgets).textBox();
+ $(".inputPsw").as(Widgets).passwordBox();
+ $(".textArea").as(Widgets).textArea();
+ $(".label").as(Widgets).label(new WidgetInitializer<Label>() {
+ public void initialize(Label label, Element e) {
+ label.setText("I'm a gwt label, created from a " + e.getTagName());
+ }
+ });
}
-}
+}
diff --git a/samples/src/main/java/gwtquery/samples/public/GwtQuerySample.html b/samples/src/main/java/gwtquery/samples/public/GwtQuerySample.html index 1477c1d1..352a2c2c 100644 --- a/samples/src/main/java/gwtquery/samples/public/GwtQuerySample.html +++ b/samples/src/main/java/gwtquery/samples/public/GwtQuerySample.html @@ -4,16 +4,44 @@ <script language="javascript" src="gwtquery.samples.GwtQuerySample.nocache.js"></script>
</head>
<body>
-<div class="outer" style='border: 4px solid red; padding: 25px; width: auto; height: 150px' >
- <div>Foo <span class="note">bar</span> baz</div>
- <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
- <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
- <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
- <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
- <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
- <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
- <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
-</div>
+ <div class="outer">
+ <div>Foo <span class="note">bar</span> baz</div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ </div>
+ <div class="outer">
+ <div class="btn">Make me a button 1!</div>
+ <a class="btn">Make me a button 2!</a>
+ <span class="btn">Make me a button 3!</span>
+ <button class="btn">Make me a button 4!</button>
+ <div class="btn">Make me a button 5!</div>
+ <div class="btn">Make me a button 6!</div>
+ </div>
+ <div class="outer">
+ <div class="inputText">I will be a text input</div>
+ <span class="inputText">I will be a text input</span>
+ <input class="inputText" type="text" value="I will be a text input"></input>
+ </div>
+ <div class="outer">
+ <div class="inputPsw">I will be an password input</div>
+ <span class="inputPsw">I will be an password input</span>
+ <input class="inputPsw" type="password" value="I will be an password input"></input>
+ </div>
+ <div class="outer">
+ <div class="textArea">I will be a text area</div>
+ <span class="textArea">I will be a text area</span>
+ <textarea class="textArea">I will be a text area</textarea>
+ </div>
+ <div class="outer">
+ <div class="label">I will be a label</div>
+ <span class="label">I will be a label</span>
+ <h1 class="label">I will be a label</h1>
+ </div>
</body>
<script>
</script>
|