Package com.google.gwt.dom.client

Examples of com.google.gwt.dom.client.Document


                     });
            }
            else
            {
               WindowEx win = sizeEditor.getPreviewIFrame().getContentWindow();
               Document doc = win.getDocument();
               NodeList<Element> images = doc.getElementsByTagName("img");
               if (images.getLength() > 0)
               {
                  ElementEx img = images.getItem(0).cast();
                  DesktopFrame frame = Desktop.getFrame();
                  frame.copyImageToClipboard(img.getClientLeft(),
View Full Code Here


              
               IFrameElementEx iframe = frame.getIFrame();
               if (iframe == null)
                  return true;
              
               Document doc = iframe.getContentDocument();
               if (doc == null)
                  return true;

               initSlides.execute();
              
View Full Code Here

      try
      {
         if (originallyActiveElement_ != null
             && !originallyActiveElement_.getTagName().equalsIgnoreCase("body"))
         {
            Document doc = originallyActiveElement_.getOwnerDocument();
            if (doc != null)
            {
               originallyActiveElement_.focus();
            }
         }
View Full Code Here

      try
      {
         if (originallyActiveElement_ != null
             && !originallyActiveElement_.getTagName().equalsIgnoreCase("body"))
         {
            Document doc = originallyActiveElement_.getOwnerDocument();
            if (doc != null)
            {
               originallyActiveElement_.focus();
            }
         }
View Full Code Here

  /**
   * Ensures that {@link RootPanel#get(String)} behaves properly.
   */
  public void testGetById() {
    Document doc = Document.get();
    DivElement div = doc.createDivElement();
    doc.getBody().appendChild(div);
    div.setInnerHTML("<div id='a'></div><div id='b'></div>");

    // You should get the same RootPanel for subsequent calls to get() with the
    // same id. But you should get *different* RootPanels for calls with
    // different ids.
    RootPanel aRoot = RootPanel.get("a");
    RootPanel bRoot = RootPanel.get("b");

    assertSame(
        "RootPanel.get() should return the same instancefor the same id",
        aRoot, RootPanel.get("a"));
    assertSame(
        "RootPanel.get() should return the same instancefor the same id",
        bRoot, RootPanel.get("b"));
    assertNotSame("RootPanels a and b should be different", aRoot, bRoot);

    // If a RootPanel's element is replaced in the DOM, you should get a
    // new RootPanel instance if you ask for it again (see issue 1937).
    Element aElem = doc.getElementById("a");
    Element newAElem = doc.createDivElement();
    newAElem.setId("a");
    aElem.getParentElement().replaceChild(newAElem, aElem);

    RootPanel newARoot = RootPanel.get("a");
    assertNotSame("New RootPanel should not be same as old", newARoot, aRoot);
View Full Code Here

  DivElement div4;
  SpanElement span1;
  SpanElement span2;

  private TestDomViaApi() {
    Document d = Document.get();
    root = d.createDivElement();
    root.appendChild(d.createTextNode("Div root"));

    div1 = d.createDivElement();
    Util.addText(div1, "Div1");
    root.appendChild(div1);

    div2 = d.createDivElement();
    Util.addText(div2, "Div2");
    div1.appendChild(div2);

    span1 = d.createSpanElement();
    Util.addText(span1, "Span1");
    div1.appendChild(span1);

    DivElement anon = d.createDivElement();
    Util.addText(anon, "Div anon");
    root.appendChild(anon);

    div3 = d.createDivElement();
    Util.addText(div3, "Div3");
    anon.appendChild(div3);

    div4 = d.createDivElement();
    Util.addText(div4, "Div4");
    div3.appendChild(div4);

    span2 = d.createSpanElement();
    Util.addText(span2, "Span2");
    div3.appendChild(span2);

    Util.addText(div1, " Div1 end");
    Util.addText(div3, " Div3 end");
View Full Code Here

  DivElement div4;
  SpanElement span1;
  SpanElement span2;

  private TestEmptyDomViaApi() {
    Document d = Document.get();
    root = d.createDivElement();
    root.appendChild(d.createTextNode("Div root"));

    div1 = d.createDivElement();
    root.appendChild(div1);

    div2 = d.createDivElement();
    div1.appendChild(div2);

    span1 = d.createSpanElement();
    div1.appendChild(span1);

    DivElement anon = d.createDivElement();
    root.appendChild(anon);

    div3 = d.createDivElement();
    anon.appendChild(div3);

    div4 = d.createDivElement();
    div3.appendChild(div4);

    span2 = d.createSpanElement();
    div3.appendChild(span2);

    setElement(root);
  }
View Full Code Here

    DOM.setStyleAttribute(elem, "position", "absolute");
    DOM.setStyleAttribute(elem, "border", border + "px solid #000");
    DOM.setStyleAttribute(elem, "padding", padding + "px");
    DOM.setStyleAttribute(elem, "margin", margin + "px");

    Document doc = Document.get();
    DOM.setStyleAttribute(elem, "top", (top - doc.getBodyOffsetLeft()) + "px");
    DOM.setStyleAttribute(elem, "left", (left - doc.getBodyOffsetTop()) + "px");

    delayTestFinish(1000);
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
      public void execute() {
View Full Code Here

        public void onValueChange(ValueChangeEvent<String> event) {
          assertEquals(testHistoryToken, event.getValue());
          assertEquals(testHistoryToken, History.getToken());
        }
      });
      Document document = Document.get();
      NativeEvent event = document.createClickEvent(1, 0, 0, 0, 0, false, false, false, false);
      link.getElement().dispatchEvent(event);
    } finally {
      RootPanel.get().remove(link);
      if (registration != null) {
        registration.removeHandler();
View Full Code Here

    // Ensure that we are scrolled.
    assertTrue(DOM.getElementPropertyInt(outer, "scrollTop") > 0);
    assertTrue(DOM.getElementPropertyInt(outer, "scrollLeft") > 0);

    Document doc = Document.get();
    assertEquals(doc.getBodyOffsetLeft(), DOM.getAbsoluteLeft(outer));
    assertEquals(doc.getBodyOffsetTop(), DOM.getAbsoluteTop(outer));
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dom.client.Document

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.