Home | History | Annotate | Download | only in ui
      1 package autotest.common.ui;
      2 
      3 import com.google.gwt.user.client.DOM;
      4 import com.google.gwt.user.client.Element;
      5 import com.google.gwt.user.client.ui.Widget;
      6 
      7 /**
      8  * A simple widget that wraps an HTML element.  This allows the element to be
      9  * removed from the document and added to a Panel.
     10  */
     11 public class ElementWidget extends Widget {
     12     protected Element element;
     13 
     14     /**
     15      * @param element the HTML element to wrap
     16      */
     17     public ElementWidget(Element element) {
     18         this.element = element;
     19         setElement(element);
     20         DOM.removeChild(DOM.getParent(element), element);
     21     }
     22 
     23     public ElementWidget(String elementId) {
     24         this(DOM.getElementById(elementId));
     25     }
     26 }
     27