Package elemental.html

Examples of elemental.html.ButtonElement


    addClassesToElement(elem, classNames);
    return elem;
  }

  public static ButtonElement createButtonElement(String... classNames) {
    ButtonElement elem = getDocument().createButtonElement();
    addClassesToElement(elem, classNames);
    return elem;
  }
View Full Code Here


   * events are fired from a subinterface of {@link EventTarget}.
   */
  public void testUncaughtException() {
    // Create a button with an event handler that will throw an exception.
    Document doc = Browser.getDocument();
    ButtonElement btn = doc.createButtonElement();
    doc.getBody().appendChild(btn);

    btn.addEventListener(Event.CLICK, new EventListener() {
      @Override
      public void handleEvent(Event evt) {
        throw new RuntimeException("w00t!");
      }
    }, false);
View Full Code Here

public class ElementalExample implements EntryPoint {

  @Override
  public void onModuleLoad() {
    final ButtonElement btn = getDocument().createButtonElement();
    btn.setInnerHTML("w00t?");
    btn.getStyle().setColor("red");
    getDocument().getBody().appendChild(btn);

    final DivElement div = getDocument().createDivElement();
    getDocument().getBody().appendChild(div);

    EventListener listener = new EventListener() {
      public void handleEvent(Event evt) {
        final XMLHttpRequest xhr = getWindow().newXMLHttpRequest();
        xhr.setOnLoad(new EventListener() {
          @Override
          public void handleEvent(Event evt) {
            div.setInnerHTML(xhr.getResponseText());
          }
        });
        xhr.open("GET", "/snippet.html");
        xhr.send();

        getWindow().setTimeout(new Window.TimerCallback() {
          @Override
          public void fire() {
            getWindow().alert("timeout fired");
          }
        }, 1000);

        btn.removeEventListener(Event.CLICK, this, false);
      }
    };

    btn.addEventListener(Event.CLICK, listener, false);
  }
View Full Code Here

    addClassesToElement(elem, classNames);
    return elem;
  }

  public static ButtonElement createButtonElement(String... classNames) {
    ButtonElement elem = getDocument().createButtonElement();
    addClassesToElement(elem, classNames);
    return elem;
  }
View Full Code Here

TOP

Related Classes of elemental.html.ButtonElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.