Refine search
/** * Creates an empty deck panel. */ public CustomDeckLayoutPanel() { setElement(Document.get().createDivElement()); layout = new Layout(getElement()); layoutCmd = new DeckAnimateCommand(layout); }
/** * 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); } }
hiddenDiv = Document.get().createDivElement(); UIObject.setVisible(hiddenDiv, false); RootPanel.getBodyElement().appendChild(hiddenDiv); Element child = Document.get().getElementById(id);
/** * Recalculate the height and width of a native scrollbar. */ private static void maybeRecalculateNativeScrollbarSize() { // Check if the size has already been calculated. if (nativeHeight > -1) { return; } // Create a scrollable element and attach it to the body. Element scrollable = Document.get().createDivElement(); scrollable.getStyle().setPosition(Position.ABSOLUTE); scrollable.getStyle().setTop(-1000.0, Unit.PX); scrollable.getStyle().setLeft(-1000.0, Unit.PX); scrollable.getStyle().setHeight(100.0, Unit.PX); scrollable.getStyle().setWidth(100.0, Unit.PX); scrollable.getStyle().setOverflow(Overflow.SCROLL); scrollable.getStyle().setProperty("direction", "rtl"); Document.get().getBody().appendChild(scrollable); // Add some content. Element content = Document.get().createDivElement(); content.setInnerText("content"); scrollable.appendChild(content); // Measure the height and width. nativeHeight = scrollable.getOffsetHeight() - scrollable.getClientHeight(); nativeWidth = scrollable.getOffsetWidth() - scrollable.getClientWidth(); nativeRtl = (content.getAbsoluteLeft() > scrollable.getAbsoluteLeft()); // Detach the scrollable element. scrollable.removeFromParent(); }
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); } }
/** * Return the temporary element used to create elements. */ private static Element getTmpElem() { if (tmpElem == null) { tmpElem = Document.get().createDivElement(); } return tmpElem; }
/** * 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; } }
/** * Return the temporary element used to create elements. */ private static Element getTmpElem() { if (tmpElem == null) { tmpElem = Document.get().createDivElement(); } return tmpElem; }
@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; } }
public Element createElement() { return Document.get().createDivElement(); }
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; }
protected LabelBase(boolean inline) { this(inline ? Document.get().createSpanElement() : Document.get().createDivElement(), inline); }
/** * 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 an empty HTML widget. */ public HTML() { super(Document.get().createDivElement()); setStyleName("gwt-HTML"); }
/** * 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 an HTML DIV element. * * @return the newly-created element */ public static com.google.gwt.user.client.Element createDiv() { return Document.get().createDivElement().cast(); }
/** * 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; }
public DomDivBuilder startDiv() { start(Document.get().createDivElement(), divBuilder); return divBuilder; }
/** * 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; }