Refine search
/** * IE6 does not allow direct access to event handlers on the parent window, * so we must embed a script in the parent window that will set the event * handlers in the correct context. * * @param initFunc the string representation of the init function * @param cmd the command to execute the init function */ private void initHandler(String initFunc, ScheduledCommand cmd) { if (GWT.isClient()) { // Embed the init script on the page ScriptElement scriptElem = Document.get().createScriptElement(initFunc); Document.get().getBody().appendChild(scriptElem); // Initialize the handler cmd.execute(); // Remove the script element Document.get().getBody().removeChild(scriptElem); } }
protected LoadTracker() { if(Document.get().getElementById(m_trackerDivId) == null) { Element div = DOM.createDiv(); div.getStyle().setPosition(Position.ABSOLUTE); div.getStyle().setTop(0.0, Unit.PX); div.getStyle().setLeft(-9999.0, Unit.PX); div.getStyle().setVisibility(Visibility.HIDDEN); div.setId("loadTracker"); Document.get().getBody().appendChild(div); } }
/** * Show or hide the glass. */ private void maybeShowGlass() { if (showing) { if (curPanel.isGlassEnabled) { Document.get().getBody().appendChild(curPanel.glass); resizeRegistration = Window.addResizeHandler(curPanel.glassResizer); curPanel.glassResizer.onResize(null); glassShowing = true; } } else if (glassShowing) { Document.get().getBody().removeChild(curPanel.glass); resizeRegistration.removeHandler(); resizeRegistration = null; glassShowing = false; } }
@Override protected void onDetach() { super.onDetach(); // Unhook the iframe's onLoad when detached. impl.unhookEvents(synthesizedFrame, getElement()); if (synthesizedFrame != null) { // And remove it from the document. Document.get().getBody().removeChild(synthesizedFrame); synthesizedFrame = null; } }
private static boolean isElementChildOfWidget(Element element) { // Walk up the DOM hierarchy, looking for any widget with an event listener // set. Though it is not dependable in the general case that a widget will // have set its element's event listener at all times, it *is* dependable // if the widget is attached. Which it will be in this case. element = element.getParentElement(); BodyElement body = Document.get().getBody(); while ((element != null) && (body != element)) { if (Event.getEventListener(element) != null) { return true; } element = element.getParentElement().cast(); } return false; }
/** * Creates an Anchor widget that wraps an existing <a> 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 Anchor wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); Anchor anchor = new Anchor(element); // Mark it attached and remember it for cleanup. anchor.onAttach(); RootPanel.detachOnWindowClose(anchor); return anchor; }
/** * Creates a Frame widget that wraps an existing <frame> 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 Frame wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); Frame frame = new Frame(element); // Mark it attached and remember it for cleanup. frame.onAttach(); RootPanel.detachOnWindowClose(frame); return frame; }
/** * Creates a PasswordTextBox widget that wraps an existing <input * type='password'> 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 PasswordTextBox wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); PasswordTextBox textBox = new PasswordTextBox(element); // Mark it attached and remember it for cleanup. textBox.onAttach(); RootPanel.detachOnWindowClose(textBox); return textBox; }
/** * Creates a Button widget that wraps an existing <button> 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 Button wrap(com.google.gwt.dom.client.Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); Button button = new Button(element); // Mark it attached and remember it for cleanup. button.onAttach(); RootPanel.detachOnWindowClose(button); return button; }
/** * Creates a Hidden widget that wraps an existing <input type='hidden'> * 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 Hidden wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); Hidden hidden = new Hidden(element); // Mark it attached and remember it for cleanup. hidden.onAttach(); RootPanel.detachOnWindowClose(hidden); return hidden; }
/** * Creates a ListBox widget that wraps an existing <select> 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 * @return list box */ 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; }
/** * Creates a SimpleRadioButton widget that wraps an existing <input * type='radio'> 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 SimpleRadioButton wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); SimpleRadioButton radioButton = new SimpleRadioButton(element); // Mark it attached and remember it for cleanup. radioButton.onAttach(); RootPanel.detachOnWindowClose(radioButton); return radioButton; }
/** * Creates a TextArea widget that wraps an existing <textarea> * 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 TextArea wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); TextArea textArea = new TextArea(element); // Mark it attached and remember it for cleanup. textArea.onAttach(); RootPanel.detachOnWindowClose(textArea); return textArea; }
/** * Creates an HTML 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 HTML wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); HTML html = new HTML(element); // Mark it attached and remember it for cleanup. html.onAttach(); RootPanel.detachOnWindowClose(html); return html; }
/** * Creates a FileUpload widget that wraps an existing <input * type='file'> 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 FileUpload wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); FileUpload fileUpload = new FileUpload(element); // Mark it attached and remember it for cleanup. fileUpload.onAttach(); RootPanel.detachOnWindowClose(fileUpload); return fileUpload; }
/** * Creates an InlineHTML 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 InlineHTML wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); InlineHTML html = new InlineHTML(element); // Mark it attached and remember it for cleanup. html.onAttach(); RootPanel.detachOnWindowClose(html); return html; }
/** * Creates a Image widget that wraps an existing <img> 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 Image wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); Image image = new Image(element); // Mark it attached and remember it for cleanup. image.onAttach(); RootPanel.detachOnWindowClose(image); return image; }
/** * Creates a ResetButton widget that wraps an existing <button> 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 Button wrap(com.google.gwt.dom.client.Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); ResetButton button = new ResetButton(element); // Mark it attached and remember it for cleanup. button.onAttach(); RootPanel.detachOnWindowClose(button); return button; }
/** * Creates an HTML panel that wraps an existing 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 HTMLPanel wrap(Element element) { // Assert that the element is attached. assert Document.get().getBody().isOrHasChild(element); HTMLPanel html = new HTMLPanel(element); // Mark it attached and remember it for cleanup. html.onAttach(); RootPanel.detachOnWindowClose(html); return html; }