Package com.google.gwt.dom.client

Examples of com.google.gwt.dom.client.Node.cast()


      Node n = o.cast();
      switch (n.getNodeType()) {
         case com.google.gwt.xml.client.Node.ATTRIBUTE_NODE:
            return JavaScriptObjects.getString(n, XML_ATTR_VALUE);
         case Node.ELEMENT_NODE:
            Element e = n.cast();
            return e.getInnerText();
         default:
            return n.getNodeValue();
      }
   }
View Full Code Here


   @PatchMethod
   static void setNodeValue(JavaScriptObject jsObject, String nodeValue) {
      Node n = jsObject.cast();
      switch (n.getNodeType()) {
         case Node.TEXT_NODE:
            Text text = n.cast();
            text.setData(nodeValue);
            break;
         case Node.ELEMENT_NODE:
            Element element = n.cast();
            element.setInnerText(nodeValue);
View Full Code Here

         case Node.TEXT_NODE:
            Text text = n.cast();
            text.setData(nodeValue);
            break;
         case Node.ELEMENT_NODE:
            Element element = n.cast();
            element.setInnerText(nodeValue);
            break;
         case Node.DOCUMENT_NODE:
            // nothing to do
            break;
View Full Code Here

  protected BRElement getSpacer(Element paragraph) {
    Node last = paragraph.getLastChild();
    BRElement spacer = paragraph.getPropertyJSO(BR_REF).cast();
    if (spacer == null) {
      // Register our spacer, using one the browser put in if present
      spacer = isSpacer(last) ? last.<BRElement>cast() : Document.get().createBRElement();
      setupSpacer(paragraph, spacer);
    } else if (isSpacer(last) && last != spacer) {
      // The browser put a different one in by itself, so let's use that one
      if (spacer.hasParentElement()) {
        spacer.removeFromParent();
View Full Code Here

    } else if (isSpacer(last) && last != spacer) {
      // The browser put a different one in by itself, so let's use that one
      if (spacer.hasParentElement()) {
        spacer.removeFromParent();
      }
      spacer = last.<BRElement>cast();
      setupSpacer(paragraph, spacer);
    }
    return spacer;
  }
View Full Code Here

      JsTextRangeIE attempt = JsTextRangeIE.create().moveToElementText(parent).collapse(true);
      while (child != null) {
        // Treat text node children separately
        if (DomHelper.isTextNode(child)) {
          // Move attempt to end of the text node
          int len = child.<Text> cast().getLength();
          attempt.move(character, len);
          // Test if attempt is now at or past target
          if (attempt.compareEndPoints(StartToStart, target) >= 0) {
            // Target is in this text node. Compute the offset by creating a new
            // text range from target to attempt and measuring the length of the
View Full Code Here

            return Point.inText(child, len - dup.getText().length());
          }
        } else {
          // Child is an element. Move attempt before child, and test
          // if attempt is at or past range
          attempt.moveToElementText(child.<Element> cast()).collapse(true);
          if (attempt.compareEndPoints(StartToStart, target) >= 0) {
            // Return the point before child
            return Point.inElement(parent, child);
          } else {
            // Move attempt past child
View Full Code Here

          high = mid - 1;
        } else {
          if (DomHelper.isTextNode(node)) {
            JsTextRangeIE dup = attempt.duplicate();
            dup.setEndPoint(EndToEnd, target);
            if (dup.getText().length() <= node.<Text> cast().getLength()) {
              return Point.inText(node, dup.getText().length());
            }
          } else {
            attempt.moveToElementText(node.<Element> cast()).collapse(false);
            if (attempt.compareEndPoints(StartToStart, target) >= 0) {
View Full Code Here

            dup.setEndPoint(EndToEnd, target);
            if (dup.getText().length() <= node.<Text> cast().getLength()) {
              return Point.inText(node, dup.getText().length());
            }
          } else {
            attempt.moveToElementText(node.<Element> cast()).collapse(false);
            if (attempt.compareEndPoints(StartToStart, target) >= 0) {
              return Point.inElement(parent, node);
            }

          }
View Full Code Here

      // not always...
      if (nodeBefore != null && DomHelper.isTextNode(nodeBefore)) {
        node = nodeBefore.cast();
        previousSelectionStart = Point.<Node>inText(node, 0);
      } else if (nodeAfter != null && DomHelper.isTextNode(nodeAfter)) {
        node = nodeAfter.cast();
        previousSelectionStart = Point.<Node>inText(node, node.getLength());
      }
    }

    TypingState t = findTypingState(previousSelectionStart);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.