Example usage for com.google.gwt.dom.client SpanElement getInnerHTML

List of usage examples for com.google.gwt.dom.client SpanElement getInnerHTML

Introduction

In this page you can find the example usage for com.google.gwt.dom.client SpanElement getInnerHTML.

Prototype

@Override
    public String getInnerHTML() 

Source Link

Usage

From source file:geogebra.web.gui.view.algebra.RadioButtonTreeItem.java

License:Open Source License

private IndexHTMLBuilder getBuilder(final SpanElement se) {
    return new IndexHTMLBuilder(false) {
        Element sub = null;/*  w ww  .j a  v a2  s .c om*/

        @Override
        public void append(String s) {

            if (sub == null) {
                se.appendChild(Document.get().createTextNode(s));
            } else {
                sub.appendChild(Document.get().createTextNode(s));
            }
        }

        @Override
        public void startIndex() {
            sub = Document.get().createElement("sub");
            sub.getStyle().setFontSize((int) (app.getFontSize() * 0.8), Unit.PX);
        }

        @Override
        public void endIndex() {
            if (sub != null) {
                se.appendChild(sub);
            }
            sub = null;
        }

        @Override
        public String toString() {
            if (sub != null) {
                endIndex();
            }
            return se.getInnerHTML();
        }

        @Override
        public void clear() {
            se.removeAllChildren();
            sub = null;
        }

        @Override
        public boolean canAppendRawHtml() {
            return false;
        }

        @Override
        public void appendHTML(String str) {
            append(str);
        }
    };
}

From source file:org.nuxeo.ecm.platform.annotations.gwt.client.util.GwtTestXPathUtil.java

License:Apache License

public void _testGetXPathDecoratedDocument() {
    createDocument();//from w  ww  . j av  a  2  s.c o m
    List<Node> nodes = xPathUtil.getNode("/html[0]/body[0]/div[0]/b[0]/span[1]", Document.get());
    assertNotNull(nodes);
    Node node = nodes.get(0);
    SpanElement span = SpanElement.as(node).cast();
    assertNotNull(span);
    assertEquals("c", span.getInnerHTML());
    node = RootPanel.get("myspan").getElement();
    String xpath = xPathUtil.getXPath(node);
    assertEquals(xpath.toLowerCase(), "/html[0]/body[0]/div[0]/b[0]/span[1]");
}

From source file:org.nuxeo.ecm.platform.annotations.gwt.client.view.GwtTestDecoratorVisitor.java

License:Apache License

public void testStraight() {
    createDocument();//w ww  .j a  v  a2 s  .  co m
    Element bNode = RootPanel.getBodyElement().getElementsByTagName("b").getItem(0);
    assertNotNull(bNode);

    AnnoteaDecoratorVisitor processor = new AnnoteaDecoratorVisitor(bNode, 8, 13, getDefaultAnnotation(), null);
    Visitor visitor = new Visitor(processor);
    visitor.process(bNode);
    assertNotNull(bNode);

    NodeList list = bNode.getChildNodes();
    SpanElement span = SpanElement.as(bNode.getParentElement());
    assertEquals(3, list.getLength());
    assertEquals(span.getInnerHTML(),
            "<b>Nuxeo EP 5 - <span class=\"decorate decorate0\">Nuxeo An</span>notation</b>");

    processor = new AnnoteaDecoratorVisitor(bNode, 5, 23, getDefaultAnnotation(), null);
    visitor = new Visitor(processor);
    visitor.process(bNode);
    assertEquals(5, bNode.getChildNodes().getLength());
    assertEquals(span.getInnerHTML(),
            "<b>Nuxeo EP 5 - <span class=\"decorate decorate0\">Nuxeo An</span>no<span class=\"decorate decorate0\">tatio</span>n</b>");
}

From source file:org.nuxeo.ecm.platform.annotations.gwt.client.view.GwtTestDecoratorVisitor.java

License:Apache License

public void testReverse() {
    createDocument();/* w  w  w  . ja v  a  2 s. c  om*/
    Element bNode = RootPanel.getBodyElement().getElementsByTagName("b").getItem(0);
    assertNotNull(bNode);

    AnnoteaDecoratorVisitor processor = new AnnoteaDecoratorVisitor(bNode, 5, 23, getDefaultAnnotation(), null);
    Visitor visitor = new Visitor(processor);
    visitor.process(bNode);
    assertNotNull(bNode);

    NodeList list = bNode.getChildNodes();
    SpanElement span = SpanElement.as(bNode.getParentElement());
    assertEquals(3, list.getLength());
    assertEquals(span.getInnerHTML(),
            "<b>Nuxeo EP 5 - Nuxeo Anno<span class=\"decorate decorate0\">tatio</span>n</b>");

    processor = new AnnoteaDecoratorVisitor(bNode, 8, 13, getDefaultAnnotation(), null);
    visitor = new Visitor(processor);
    visitor.process(bNode);
    assertEquals(5, bNode.getChildNodes().getLength());
    assertEquals(span.getInnerHTML(),
            "<b>Nuxeo EP 5 - <span class=\"decorate decorate0\">Nuxeo An</span>no<span class=\"decorate decorate0\">tatio</span>n</b>");
}