Package org.waveprotocol.wave.client.editor.content

Examples of org.waveprotocol.wave.client.editor.content.ContentTextNode


    if (!cp.getContainer().isContentAttached()) {
      return false;
    }

    if (cp.getContainer().isTextNode()) {
      ContentTextNode textNode = (ContentTextNode) cp.getContainer();
      return cp.getTextOffset() <= textNode.getLength();
    } else {
      ContentNode nodeAfter = cp.getNodeAfter();
      return nodeAfter == null || cp.getContainer() == nodeAfter.getParentElement();
    }
  }
View Full Code Here


      Text node = previousSelectionStart.getContainer().cast();
      ContentView renderedContent = renderedContentView;
      HtmlView filteredHtml = filteredHtmlView;
      try {
        // This might throw an exception
        ContentTextNode wrapper = manager.findTextWrapper(node, true);

        // No exception -> already a wrapper for this node (we're editing some existing text)
        firstWrapper = wrapper;
        lastWrapper = wrapper;

        checkNeighbouringTextNodes(previousSelectionStart);

        contentRange = RestrictedRange.around(renderedContent, firstWrapper, lastWrapper);

        // Ensure methods we call on the text node operate on the same view as us
        assert wrapper.getFilteredHtmlView() == filteredHtml;

        Node htmlNodeBefore = filteredHtml.getPreviousSibling(firstWrapper.getImplNodelet());
        Element htmlParent = filteredHtml.getParentElement(node);
        ContentNode cnodeAfter = contentRange.getNodeAfter();
        Node htmlNodeAfter = cnodeAfter == null ? null : cnodeAfter.getImplNodelet();
View Full Code Here

          boolean inserting = startIndex < insertEndIndex;

          int deleteSize = deleteEndIndex - startIndex;

          // Figure out what node the start point lies in
          ContentTextNode startNode = firstWrapper, deleteEndNode = firstWrapper;
          if (firstWrapper.getLength() < startIndex) {
            assert firstWrapper != lastWrapper : "first wrapper != lastWrapper";
            startIndex -= firstWrapper.getLength();
            startNode = lastWrapper;
          }
View Full Code Here

              Point.inElement(parentElement, (ContentNode) null),
              Point.start(filteredHtml, parentNodelet)
            );
      }

      ContentTextNode possibleOwner;
      try {
        possibleOwner = (ContentTextNode) possibleOwnerNode;
      } catch (ClassCastException e) {
        if (possibleOwnerNode.isImplAttached()) {
          // Scenario (C)
          throw new HtmlInserted(
                Point.inElement(parentElement, possibleOwnerNode),
                Point.inElementReverse(filteredHtml, parentNodelet, nodeletBeforeTextNodes)
              );
        } else {
          // Scenario (A)
          // Not minor, an element has gone missing
          throw new HtmlMissing(possibleOwnerNode, parentNodelet);
        }
      }

      ContentNode nextNode = renderedContent.getNextSibling(possibleOwner);
      if (nextNode != null && !nextNode.isImplAttached()) {
        // Scenario (E)
        throw new HtmlMissing(nextNode, parentNodelet);
      }

      if (current != possibleOwner.getImplNodelet()) {
        // Scenario (B)
        if (attemptRepair) {
          possibleOwner.setTextNodelet(current);
          return nullifyIfWrongDocument(possibleOwner);
        } else {
          // TODO(danilatos): Ensure repairs handle nodes on either
          // side, as this is kind of a "replace" error
          throw new HtmlInserted(
View Full Code Here

    if (getTransparency(text.getParentElement()) == Skip.DEEP) {
      Element e = text.getParentElement();
      return elementNodeToWrapperPoint(e.getParentElement(), e);
    } else {
      ContentTextNode textNode = findTextWrapper(text, true);
      return Point.<ContentNode> inText(textNode, offset + textNode.getOffset(text));
    }
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.client.editor.content.ContentTextNode

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.