Przeglądaj źródła

use new way to set CSS

tags/release-1.3.2
Julien Dramaix 13 lat temu
rodzic
commit
c6b2acfae7

+ 9
- 5
samples/src/main/java/gwtquery/samples/client/GwtQueryEffectsModule.java Wyświetl plik

@@ -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'");
}

+ 6
- 3
samples/src/main/java/gwtquery/samples/client/GwtQuerySampleModule.java Wyświetl plik

@@ -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

+ 7
- 8
samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java Wyświetl plik

@@ -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(){

Ładowanie…
Anuluj
Zapisz