Example usage for com.google.gwt.query.client.plugins.widgets WidgetInitializer WidgetInitializer

List of usage examples for com.google.gwt.query.client.plugins.widgets WidgetInitializer WidgetInitializer

Introduction

In this page you can find the example usage for com.google.gwt.query.client.plugins.widgets WidgetInitializer WidgetInitializer.

Prototype

WidgetInitializer

Source Link

Usage

From source file:gwtquery.samples.client.GwtQuerySampleModule.java

License:Apache License

public void onModuleLoad() {
    // Use compiled selectors
    Sample s = GWT.create(Sample.class);

    // Just a simple usage of dom manipulation, events, and lazy usage
    s.allNotes().text("Hello Google I/O").css(CSS.CURSOR.with(Cursor.POINTER))
            .toggle(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);/*from ww  w.  j  ava  2s. c  om*/

    // 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());
        }
    });
}