Package com.google.gwt.dom.client

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


    if ( !this.getElement().isOrHasChild( this.text.getElement() ) ) {
      Node toRemove = null;
      for ( int i = 0; i < this.getElement().getChildCount(); i++) {
        Node n = this.getElement().getChildNodes().getItem( i );
        if ( n.getNodeType() == 3 /*TEXT_NODE*/ ) {
          Text t = n.<Text>cast();
          if ( t.getNodeValue().equals( this.text.getText() ) || t.getNodeValue().equals( text ) ) {
            toRemove = t;
          }
        }
      }
      if ( toRemove != null ) {
View Full Code Here


public class TextTest extends GwtTestTest {

   @Test
   public void checkToString() {
      // Arrange
      Text text = Document.get().createTextNode("some text");

      // Act
      String toString = text.toString();

      // Assert
      assertEquals("'some text'", toString);

   }
View Full Code Here

   }

   @Test
   public void nodeValue_Text() {
      // Arrange
      Text textNode = Document.get().createTextNode("data");
      // Pre-Assert
      assertEquals("data", textNode.getNodeValue());

      // Act
      textNode.setNodeValue("node");

      // Assert
      assertEquals("node", textNode.getNodeValue());
      assertEquals("node", textNode.getData());
   }
View Full Code Here

         case Node.DOCUMENT_NODE:
            return null;
         case Node.ELEMENT_NODE:
            return null;
         case Node.TEXT_NODE:
            Text text = node.cast();
            return text.getData();
         default:
            throw new GwtTestDomException("Invalid Node type (not a Document / Element / Text : "
                     + node.getNodeType());
      }
   }
View Full Code Here

            break;
         case Node.ELEMENT_NODE:
            // nothing to do
            break;
         case Node.TEXT_NODE:
            Text text = node.cast();
            text.setData(nodeValue);
            break;
      }
   }
View Full Code Here

   @Test
   public void createTextNode() {
      // Act
      String data = "myData";
      Text text = d.createTextNode(data);

      // Assert
      assertEquals(Node.TEXT_NODE, text.getNodeType());
      assertEquals(data, text.getData());
   }
View Full Code Here

      switch (nodeType) {
         case Node.DOCUMENT_NODE:
            return documentToString(jso.<Document> cast());
         case Node.TEXT_NODE:
            Text text = jso.cast();
            return "'" + text.getData() + "'";
         case Node.ELEMENT_NODE:
            return elementToString(jso.<Element> cast());
         default:
            if (JsoUtils.isNodeList(jso)) {
               NodeList<?> nodeList = jso.cast();
View Full Code Here

   static String getInnerHTML(Object domImpl, Element elem) {
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < elem.getChildNodes().getLength(); i++) {
         Node current = elem.getChildNodes().getItem(i);
         if (current.getNodeType() == Node.TEXT_NODE) {
            Text text = current.cast();
            sb.append(text.getData());
         } else {
            sb.append(current.toString());
         }
      }
View Full Code Here

      for (int i = 0; i < elem.getChildNodes().getLength(); i++) {
         Node node = list.getItem(i);
         switch (node.getNodeType()) {
            case Node.TEXT_NODE:
               Text text = node.cast();
               String data = text.getData();
               data = "&nbsp;".equals(data) ? " " : data;
               sb.append(data);
               break;
            case Node.ELEMENT_NODE:
               Element childNode = node.cast();
View Full Code Here

   @PatchMethod
   static JavaScriptObject createCDATASection(JavaScriptObject jsObject, String data) {
      Document document = jsObject.cast();

      Text text = JsoUtils.newNode(com.google.gwt.xml.client.Node.CDATA_SECTION_NODE).cast();
      JavaScriptObjects.setProperty(text, JsoProperties.NODE_OWNER_DOCUMENT, document);

      text.setData(data);

      return text;
   }
View Full Code Here

TOP

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

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.