public Example1InnerWidget(Element anElement) {
    setElement(anElement);
    onAttach();
    RootPanel.detachOnWindowClose(this);

    // do something visible to show that we've bound to the element
    getElement().getStyle().setColor("green");
    getElement().getStyle().setFontStyle(FontStyle.ITALIC);
  }
Example #2
0
  public static ListBox wrap(Element element) {
    // Assert that the element is attached.
    assert Document.get().getBody().isOrHasChild(element);

    ListBox listBox = new ListBox(element);

    // Mark it attached and remember it for cleanup.
    listBox.onAttach();
    RootPanel.detachOnWindowClose(listBox);

    return listBox;
  }
 public void attach() {
   onAttach();
   RootPanel.detachOnWindowClose(this);
 }