Package com.google.gwt.dom.client

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


      wrapperBeforeTextNodes = null;
      possibleOwnerNode = renderedContent.getFirstChild(parentElement);
    } else {
      // reached an element
      wrapperBeforeTextNodes = NodeManager.getBackReference(
          nodeletBeforeTextNodes.<Element>cast());
      possibleOwnerNode = renderedContent.getNextSibling(wrapperBeforeTextNodes);
    }

    // Scan to find a matching pair
    while (true) {
View Full Code Here


        return null;
      }

      Node lastWrappedNodelet = container.getLastChild();
      while (lastWrappedNodelet != null && !DomHelper.isTextNode(lastWrappedNodelet)
          && NodeManager.getBackReference(lastWrappedNodelet.<Element>cast()) == null) {
        lastWrappedNodelet = lastWrappedNodelet.getPreviousSibling();
      }
      nodeletAfter = lastWrappedNodelet == null
          ? container.getFirstChild() : lastWrappedNodelet.getNextSibling();
    } else {
View Full Code Here

  public void moveCaret(int distance) {
    Point<Node> caret = getSelectionStart();
    if (!caret.isInTextNode()) {
      Node before = Point.nodeBefore(htmlView, caret.asElementPoint());
      if (DomHelper.isTextNode(before)) {
        caret = Point.inText(before, before.<Text>cast().getLength());
      } else if (DomHelper.isTextNode(caret.getNodeAfter())) {
        caret = Point.inText(caret.getNodeAfter(), 0);
      } else {
        throw new RuntimeException("Unimplemented/Invalid");
      }
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

        // Exception caught -> no wrapper for this node (we're starting a new chunk of text)
        Node nodeAfter = e.getHtmlPoint().getNodeAfter();
        if (!DomHelper.isTextNode(nodeAfter)) {
          throw e;
        }
        node = nodeAfter.cast();

        contentRange = RestrictedRange.collapsedAt(renderedContent, e.getContentPoint());
        Node before = contentRange.getNodeBefore() == null
            ? null : contentRange.getNodeBefore().getImplNodelet();
        Node after = contentRange.getNodeAfter() == null
View Full Code Here

      Text textNode = signal.getTarget().cast();
      if (textNode.getLength() > 0) {
        Node e = textNode.getPreviousSibling();
        if (e != null && !DomHelper.isTextNode(e)
            && e.<Element>cast().getTagName().toLowerCase().equals("a")) {

          FocusedPointRange<Node> selection =  editorInteractor.getHtmlSelection();
          if (selection.isCollapsed() && selection.getFocus().getTextOffset() == 0) {
            editorInteractor.noteWebkitEndOfLinkHackOccurred(textNode);
          }
View Full Code Here

  public void handleMutationEvent(SignalEvent event) {
    // TODO(user): Do we care about other types of events?
    if (event.getType().equals("DOMNodeRemoved")) {
      Node target = event.getTarget();
      boolean ignorableWhenEmpty = DomHelper.isTextNode(target)
          || !NodeManager.hasBackReference(target.<Element>cast());
      if (ignorableWhenEmpty && entries.isEmpty()) {
        // If it's a text node, or a non-backreferenced element,
        // and we don't already have entries, then we just ignore it as regular typing. Ok.
      } else {
View Full Code Here

        // If it's a text node, or a non-backreferenced element,
        // and we don't already have entries, then we just ignore it as regular typing. Ok.
      } else {

        EditorStaticDeps.logger.trace().log("REVERT REMOVAL: " + (DomHelper.isTextNode(target)
            ? target.<Text>cast().getData() : target.<Element>cast().getTagName()));

        addEntry(new RemovalEntry(target, target.getParentElement(), target.getNextSibling(),
            ignorableWhenEmpty));
      }
    }
View Full Code Here

        // If it's a text node, or a non-backreferenced element,
        // and we don't already have entries, then we just ignore it as regular typing. Ok.
      } else {

        EditorStaticDeps.logger.trace().log("REVERT REMOVAL: " + (DomHelper.isTextNode(target)
            ? target.<Text>cast().getData() : target.<Element>cast().getTagName()));

        addEntry(new RemovalEntry(target, target.getParentElement(), target.getNextSibling(),
            ignorableWhenEmpty));
      }
    }
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

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.