Example usage for com.google.gwt.user.client.ui Button wrap

List of usage examples for com.google.gwt.user.client.ui Button wrap

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Button wrap.

Prototype

public static Button wrap(com.google.gwt.dom.client.Element element) 

Source Link

Document

Creates a Button widget that wraps an existing <button> element.

Usage

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** preserves event handlers on element to be wrapped */
public static Widget elementToWidget(Element e, String typ) {
    Widget result = null;// w  w  w.j  ava 2s .  com
    if (e != null) {
        int eventsSunk = DOM.getEventsSunk(e);
        EventListener el = DOM.getEventListener(e);
        if (typ == TEXT)
            result = TextBox.wrap(e);
        else if (typ == TEXT_AREA)
            result = TextArea.wrap(e);
        else if (typ == PASSWORD)
            result = PasswordTextBox.wrap(e);
        else if (typ == LABEL)
            result = Label.wrap(e);
        else if (typ == A)
            result = Anchor.wrap(e);
        else if (typ == IMAGE)
            result = Image.wrap(e);
        else if (typ == SELECT)
            result = ListBox.wrap(e);
        else if (typ == HIDDEN)
            result = Hidden.wrap(e);
        else if (typ == FILE)
            result = FileUpload.wrap(e);
        else if (typ == FORM)
            result = FormPanel.wrap(e, true);
        else if (typ == FRAME)
            result = Frame.wrap(e);
        else if (typ == SUBMIT)
            result = SubmitButton.wrap(e);
        else if (typ == BUTTON)
            result = Button.wrap(e);
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
        DOM.sinkEvents(e, eventsSunk);
        DOM.setEventListener(e, el);
    } else {
        if (typ == TEXT)
            result = new TextBox();
        else if (typ == TEXT_AREA)
            result = new TextArea();
        else if (typ == PASSWORD)
            result = new PasswordTextBox();
        else if (typ == LABEL)
            result = new Label();
        else if (typ == A)
            result = new Anchor();
        else if (typ == SELECT)
            result = new ListBox();
        else if (typ == IMAGE)
            result = new Image();
        else if (typ == HIDDEN)
            result = new Hidden();
        else if (typ == FILE)
            result = new FileUpload();
        else if (typ == FORM)
            result = new FormPanel();
        else if (typ == FRAME)
            result = new Frame();
        else if (typ == SUBMIT)
            result = new SubmitButton();
        else if (typ == BUTTON)
            result = new Button();
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
    }
    return result;
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** preserves event handlers on element to be wrapped  */
public static Widget elementToWidget(String elementName, String typ) {
    Widget result = null;//from  ww  w . ja v a  2  s .c o m
    Element e = DOM.getElementById(elementName);
    if (e != null) {
        int eventsSunk = DOM.getEventsSunk(e);
        EventListener el = DOM.getEventListener(e);
        if (typ == TEXT)
            result = TextBox.wrap(e);
        else if (typ == TEXT_AREA)
            result = TextArea.wrap(e);
        else if (typ == PASSWORD)
            result = PasswordTextBox.wrap(e);
        else if (typ == LABEL)
            result = Label.wrap(e);
        else if (typ == A)
            result = Anchor.wrap(e);
        else if (typ == SELECT)
            result = ListBox.wrap(e);
        else if (typ == IMAGE)
            result = Image.wrap(e);
        else if (typ == HIDDEN)
            result = Hidden.wrap(e);
        else if (typ == FILE)
            result = FileUpload.wrap(e);
        else if (typ == FORM)
            result = FormPanel.wrap(e, true);
        else if (typ == FRAME)
            result = Frame.wrap(e);
        else if (typ == SUBMIT)
            result = SubmitButton.wrap(e);
        else if (typ == BUTTON)
            result = Button.wrap(e);
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
        DOM.sinkEvents(e, eventsSunk);
        DOM.setEventListener(e, el);
    } else {
        if (typ == TEXT)
            result = new TextBox();
        else if (typ == TEXT_AREA)
            result = new TextArea();
        else if (typ == PASSWORD)
            result = new PasswordTextBox();
        else if (typ == LABEL)
            result = new Label();
        else if (typ == A)
            result = new Anchor();
        else if (typ == IMAGE)
            result = new Image();
        else if (typ == SELECT)
            result = new ListBox();
        else if (typ == HIDDEN)
            result = new Hidden();
        else if (typ == FILE)
            result = new FileUpload();
        else if (typ == FORM)
            result = new FormPanel();
        else if (typ == FRAME)
            result = new Frame();
        else if (typ == SUBMIT)
            result = new SubmitButton();
        else if (typ == BUTTON)
            result = new Button();
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
    }
    return result;
}

From source file:com.github.gilbertotorrezan.gwtcloudinary.client.CloudinaryUploadWidget.java

License:Open Source License

protected CloudinaryUploadWidget(Element elem) {
    button = Button.wrap(elem);
    initialize();
}

From source file:com.googlesource.gerrit.plugins.reviewers.client.ReviewersScreen.java

License:Apache License

Panel createOneEntry(final ReviewerEntry e) {
    Label l = new Label(e.reviewer);
    l.setStyleName("reviewers-reviewerLabel");

    Image img = new Image(REMOVE_BUTTON_IMG);
    Button removeButton = Button.wrap(img.getElement());
    removeButton.setStyleName("reviewers-removeButton");
    removeButton.setTitle("remove reviewer");
    removeButton.addClickHandler(new ClickHandler() {
        @Override//from w w w  .  j av  a2  s . c om
        public void onClick(final ClickEvent event) {
            doSave(Action.REMOVE, e);
        }
    });
    removeButton.setVisible(isOwner);

    HorizontalPanel p = new HorizontalPanel();
    p.add(l);
    p.add(removeButton);
    return p;
}

From source file:com.gwt.demo.client.UIController.java

License:Apache License

public static void start() {
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override/*w ww .j  a va 2s  .co m*/
        public void execute() {
            CallOut startCallOut = new CallOut("startTourBtn", Placement.TOP);
            startCallOut.setTitle("Take an example tour");
            startCallOut.setContent("Start by taking an example tour to see GWT-Tour in action!");
            startCallOut.setWidth(240);
            startCallOut.centerXOffset();
            startCallOut.centerArrowOffset();
            GwtTour.createCallOut(startCallOut);

            Button.wrap(Document.get().getElementById("startTourBtn")).addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    GwtTour.removeAllCallOuts();
                    startTour();
                }
            });
        }
    });
}