diff options
author | Julien Dramaix <julien.dramaix@gmail.com> | 2011-02-28 22:25:16 +0000 |
---|---|---|
committer | Julien Dramaix <julien.dramaix@gmail.com> | 2011-02-28 22:25:16 +0000 |
commit | c6b2acfae76a38e4a343e0fa31d37724703b4295 (patch) | |
tree | 9efcdcd2699c253def97b1c0997307a23f3925a3 /samples | |
parent | b49ba264f67e09929ea8255a183dd1071497d524 (diff) | |
download | gwtquery-c6b2acfae76a38e4a343e0fa31d37724703b4295.tar.gz gwtquery-c6b2acfae76a38e4a343e0fa31d37724703b4295.zip |
use new way to set CSS
Diffstat (limited to 'samples')
3 files changed, 22 insertions, 16 deletions
diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryEffectsModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryEffectsModule.java index 083ad9a4..e6ffe542 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQueryEffectsModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryEffectsModule.java @@ -21,7 +21,11 @@ import static com.google.gwt.query.client.GQuery.lazy; import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.query.client.Function;
+import com.google.gwt.query.client.css.CSS;
+import com.google.gwt.query.client.css.Length;
+import com.google.gwt.query.client.css.RGBColor;
import com.google.gwt.query.client.plugins.Effects;
import com.google.gwt.query.client.plugins.PropertiesAnimation.Easing;
import com.google.gwt.user.client.Event;
@@ -29,11 +33,11 @@ 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 > div").css(CSS.COLOR.with(RGBColor.BLUE))
+ .hover(lazy().css(CSS.COLOR.with(RGBColor.RED)).done(),
+ lazy().css(CSS.COLOR.with(RGBColor.BLUE)).done());
- $("div.outer > div").css("position", "relative").dblclick(new Function() {
+ $("div.outer > div").css(CSS.POSITION.with(Position.RELATIVE)).dblclick(new Function() {
public boolean f(Event e) {
$("div.outer > div").as(Effects.Effects).
animate($$("left: '+=100'"), 400, Easing.LINEAR).
@@ -49,7 +53,7 @@ public class GwtQueryEffectsModule implements EntryPoint { final Effects a = $(".a, .b > div:nth-child(2)").as(Effects.Effects);
final Effects b = $(".b > div:nth-child(odd)").as(Effects.Effects);
- $("#b0").width(150).css("font-size", "10px").toggle(new Function() {
+ $("#b0").width(150).css(CSS.FONT_SIZE.with(Length.px(10))).toggle(new Function() {
public void f(Element e) {
$("#b0").as(Effects.Effects).animate(" width: '400', opacity: '0.4', marginLeft: '0.6in', fontSize: '24px'");
}
diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java index ac793721..298e420d 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java @@ -21,9 +21,12 @@ 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.dom.client.Style.Cursor;
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.user.client.Window;
public class GwtQuerySampleModule implements EntryPoint {
@@ -39,10 +42,10 @@ public class GwtQuerySampleModule implements EntryPoint { // Just a simple usage of dom manipulation, events, and lazy usage
s.allNotes().text("Hello Google I/O").
- css("cursor", "pointer").
+ css(CSS.CURSOR.with(Cursor.POINTER)).
toggle(
- lazy().css("color", "red").done(),
- lazy().css("color", "").done()
+ lazy().css(CSS.COLOR.with(RGBColor.RED)).done(),
+ lazy().css(CSS.COLOR.with(null)).done()
);
// Cascade effects
diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java index 7ef2ce03..8ec6008a 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java @@ -19,18 +19,17 @@ import static com.google.gwt.query.client.GQuery.$; import static com.google.gwt.query.client.plugins.widgets.Widgets.Widgets;
import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.GQuery;
-import com.google.gwt.query.client.css.BackgroundAttachmentProperty.BackgroundAttachment;
-import com.google.gwt.query.client.css.BackgroundPositionProperty.BackgroundPosition;
-import com.google.gwt.query.client.css.BackgroundRepeatProperty.BackgroundRepeat;
import com.google.gwt.query.client.css.CSS;
-import com.google.gwt.query.client.css.ImageValue;
+import com.google.gwt.query.client.css.UriValue;
import com.google.gwt.query.client.css.Length;
import com.google.gwt.query.client.css.RGBColor;
+import com.google.gwt.query.client.css.BackgroundAttachmentProperty.BackgroundAttachment;
+import com.google.gwt.query.client.css.BackgroundPositionProperty.BackgroundPosition;
+import com.google.gwt.query.client.css.BackgroundRepeatProperty.BackgroundRepeat;
import com.google.gwt.query.client.plugins.widgets.widgetfactory.ButtonWidgetFactory.ButtonOptions;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
@@ -92,9 +91,9 @@ public class GwtQueryWidgetModule implements EntryPoint { // $("#aaa").css(CSS.TOP, Length.cm(15));
// $("#aaa").css(CSS.BACKGROUND, RGBColor.RED, ImageValue.url(""), BackgroundRepeat.NO_REPEAT, BackgroundAttachment.FIXED, BackgroundPosition.CENTER);
- $("#aaa").setCss(CSS.TOP.with(Length.cm(15)));
- $("#aaa").setCss(CSS.BACKGROUND.with(RGBColor.SILVER, ImageValue.url(""), BackgroundRepeat.NO_REPEAT, BackgroundAttachment.FIXED, BackgroundPosition.CENTER));
- $("#aaa").setCss(CSS.BACKGROUND_ATTACHMENT.with(BackgroundAttachment.FIXED));
+ $("#aaa").css(CSS.TOP.with(Length.cm(15)));
+ $("#aaa").css(CSS.BACKGROUND.with(RGBColor.SILVER, UriValue.url(""), BackgroundRepeat.NO_REPEAT, BackgroundAttachment.FIXED, BackgroundPosition.CENTER));
+ $("#aaa").css(CSS.BACKGROUND_ATTACHMENT.with(BackgroundAttachment.FIXED));
}
private ButtonOptions createButtonOptions(){
|