Package com.google.gwt.dom.client

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


  private static class LazyItem extends Tree.Item {
    private static void addLabelForEvent(Element itemElem, Presenter presenter,
        UiEvent event) {
      itemElem.setInnerText(UiEvent.typeToDetailedTypeString(event));
      itemElem.setInnerText(presenter.getLabel(event));
      final SpanElement timesElem = itemElem.appendChild(itemElem.getOwnerDocument().createSpanElement());
      timesElem.getStyle().setProperty("cssText", TIME_LABEL_STYLE);
      if (event.getType() == EventRecordType.AGGREGATED_EVENTS) {
        timesElem.setInnerText(" "
            + TimeStampFormatter.formatMilliseconds(event.getSelfTime(), 1));
      } else {
        timesElem.setInnerText(" "
            + TimeStampFormatter.formatMilliseconds(event.getDuration(), 1)
            + " (self "
            + TimeStampFormatter.formatMilliseconds(event.getSelfTime(), 1)
            + ")");
      }
View Full Code Here


        bottomDiv = container.getDocument().createDivElement();
        bottomDiv.setClassName(css.treeItemBottomDiv());
        this.getItemLabelElement().appendChild(bottomDiv);

        final JsSymbol symbol = profileNode.getSymbol();
        SpanElement symbolNameElement = container.getDocument().createSpanElement();
        symbolNameElement.setInnerText(formatSymbolName(symbol));
        topDiv.appendChild(symbolNameElement);
        renderResourceLocation(topDiv, symbol);
        SpanElement timeValue = container.getDocument().createSpanElement();
        topDiv.appendChild(timeValue);
        timeValue.setInnerHTML(" <b>self: " + formatSelfTime(profileNode)
            + "%</b> (" + formatTime(profileNode) + "%)");
      }
View Full Code Here

      HintletIndicator indicator = new HintletIndicator(severityContainer,
          severity, count, "", getOwningTree().getResources());
      getItemLabelElement().appendChild(indicator.getElement());

      // Make a placeholder element for the label text.
      SpanElement labelText = Document.get().createSpanElement();
      getItemLabelElement().appendChild(labelText);

      labelText.setInnerText(" " + HintRecord.severityToString(severity));

      // Add child nodes.
      for (int i = 0; i < hintletRecords.size(); i++) {
        HintRecord rec = hintletRecords.get(i);
        if (rec.getSeverity() == severity) {
View Full Code Here

      Selection sel = Selection.get(NativeWindow.get(doc));
      Range selRng = sel.getRangeAt(0);
      if (selRng == null)
         return null;
      sel.removeAllRanges();
      SpanElement span = doc.createSpanElement() ;

      Range rng = selRng.cloneRange();
      rng.collapse(true);
      rng.insertNode(span) ;

      int x = span.getAbsoluteLeft() ;
      int y = span.getAbsoluteTop() ;
      int w = 0;
      int h = span.getOffsetHeight() ;
      Rectangle result = new Rectangle(x, y, w, h) ;

      ElementEx parent = (ElementEx)span.getParentElement() ;
      parent.removeChild(span) ;
      parent.normalize() ;
      sel.setRange(selRng);
      return result;
   }
View Full Code Here

               trailingOutputConsole_ = console;
            }
         }
         else
         {
            SpanElement span = Document.get().createSpanElement();
            span.setClassName(className);
            span.setInnerText(text);
            node = span;
            if (!addToTop)
            {
               trailingOutput_ = null;
               trailingOutputConsole_ = null;
View Full Code Here

      // Force render to avoid subtle command movement in the console, caused
      // by the prompt disappearing before the input line does
      input_.forceImmediateRender();
      prompt_.setHTML("");

      SpanElement pendingPrompt = Document.get().createSpanElement();
      pendingPrompt.setInnerText(promptText);
      pendingPrompt.setClassName(styles_.prompt() + " " + KEYWORD_CLASS_NAME);

      if (!suppressPendingInput_ && !input_.isPasswordMode())
      {
         SpanElement pendingInput = Document.get().createSpanElement();
         String[] lines = StringUtil.notNull(commandText).split("\n");
         String firstLine = lines.length > 0 ? lines[0] : "";
         pendingInput.setInnerText(firstLine + "\n");
         pendingInput.setClassName(styles_.command() + " " + KEYWORD_CLASS_NAME);
         pendingInput_.getElement().appendChild(pendingPrompt);
         pendingInput_.getElement().appendChild(pendingInput);
         pendingInput_.setVisible(true);
      }
View Full Code Here

        sideBar.getInnerText().endsWith("like that..."));
    assertEquals("Should have no id", "", sideBar.getAttribute("id"));
  }

  public void testDomAccessInHtmlPanel() {
    SpanElement messageInMain = widgetUi.messageInMain;
    String text = messageInMain.getInnerText().trim();
    assertTrue("sideBar should start: \"This is the main area\"",
        text.startsWith("This is the main area"));
    assertTrue("sideBar should end: \"example.\"", text.endsWith("example."));
  }
View Full Code Here

    // For example, the rendered value should be inside
    assertSpanContainsRenderedValue(root);

    // Get nameSpan
    SpanElement nameSpan = renderer.getNameSpan(docDiv);
    assertSpanContainsRenderedValueText(RENDERED_VALUE, nameSpan.getFirstChild());

    // Getters also work from the root element
    DivElement root2 = renderer.getRoot(root);
    assertTrue(renderer.isParentOrRenderer(root2));
    assertNotNull(root2);
    assertSpanContainsRenderedValue(root2);
    nameSpan = renderer.getNameSpan(root);
    assertSpanContainsRenderedValueText(RENDERED_VALUE, nameSpan.getFirstChild());
  }
View Full Code Here

    } catch (NullPointerException e) {
      // Expected
    }

    DivElement root = renderer.getRoot(docDiv);
    SpanElement nameSpan = renderer.getNameSpan(docDiv);

    // remove nameSpan
    nameSpan.removeFromParent();
    try {
      renderer.getNameSpan(docDiv);
      fail("Expected IllegalStateException because nameSpan was removed");
    } catch (IllegalStateException e) {
      // In dev mode this is different from not being attached
      assertFalse(GWT.isProdMode());
    } catch (IllegalArgumentException e) {
      // Otherwise the same error as being not attached
      assertTrue(GWT.isProdMode());
    }

    // Add a a sibling to the root element and remove the root from the parent altogether
    SpanElement spanElement = Document.get().createSpanElement();
    docDiv.appendChild(spanElement);
    root.removeFromParent();

    assertFalse(renderer.isParentOrRenderer(docDiv));
    if (GWT.isProdMode()) {
      // In prod mode no attempt is made to check whether root is still attached
      assertTrue(renderer.isParentOrRenderer(root));
    } else {
      assertFalse(renderer.isParentOrRenderer(root));
    }
    try {
      renderer.getRoot(docDiv);
      fail("Expected an IllegalArgumentException to fail because parent does not contain the root");
    } catch (IllegalArgumentException e) {
      // Expected
    }

    try {
      renderer.getNameSpan(docDiv);
      fail("Expected an IllegalArgumentException to fail because parent does not contain the root");
    } catch (IllegalArgumentException e) {
      // Expected
    }

    // Finally remove the spanElement too
    spanElement.removeFromParent();

    assertFalse(renderer.isParentOrRenderer(docDiv));
    try {
      renderer.getRoot(docDiv);
      fail("Expected an IllegalArgumentException to fail because parent does not contain the root");
View Full Code Here

    assertEquals(root, rootAgain);

    if (GWT.isProdMode()) {
      // In prod mode we avoid checking for being the only child
      assertTrue(renderer.isParentOrRenderer(docDiv));
      SpanElement nameSpan = renderer.getNameSpan(docDiv);
      assertSpanContainsRenderedValueText(RENDERED_VALUE, nameSpan.getFirstChild());
    } else {
      // in dev mode an explicit check is made
      assertFalse(renderer.isParentOrRenderer(docDiv));
      try {
        renderer.getNameSpan(docDiv);
View Full Code Here

TOP

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

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.