/** * Creates a Label widget that wraps an existing <div> or <span> * element. * * This element must already be attached to the document. If the element is * removed from the document, you must call * {@link RootPanel#detachNow(Widget)}. * * @param element the element to be wrapped */ public static Label wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); Label label = new Label(element); // Mark it attached and remember it for cleanup. label.onAttach(); RootPanel.detachOnWindowClose(label); return label; }
/** * Creates a Label widget that wraps an existing <div> or <span> * element. * * This element must already be attached to the document. If the element is * removed from the document, you must call * {@link RootPanel#detachNow(Widget)}. * * @param element the element to be wrapped */ public static Label wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); Label label = new Label(element); // Mark it attached and remember it for cleanup. label.onAttach(); RootPanel.detachOnWindowClose(label); return label; }
/** * Creates a Label widget that wraps an existing <div> or <span> * element. * * This element must already be attached to the document. If the element is * removed from the document, you must call * {@link RootPanel#detachNow(Widget)}. * * @param element the element to be wrapped */ public static Label wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); Label label = new Label(element); // Mark it attached and remember it for cleanup. label.onAttach(); RootPanel.detachOnWindowClose(label); return label; }