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

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


        Point.<ContentNode> end(newParaElement());

    EditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    FakeEditorInteractor interactor = setupFakeEditorInteractor(new FocusedContentRange(caret));
    final Point<ContentNode> newCaret = Point.<ContentNode>inText(
        new ContentTextNode(Document.get().createTextNode("hi"), null), 2);
    interactor.call(FakeEditorInteractor.NORMALIZE_POINT).returns(newCaret);
    interactor.call(FakeEditorInteractor.SET_CARET).nOf(1).withArgs(newCaret);
    interactor.call(FakeEditorInteractor.NOTIFYING_TYPING_EXTRACTOR).nOf(1).withArgs(
        newCaret, false);
    EditorEventHandler handler = createEditorEventHandler(interactor, subHandler);
View Full Code Here


    //Event event = Document.get().createKeyPressEvent(
    //    false, false, false, false, KeyCodes.KEY_BACKSPACE, 0).cast();

    Text input = Document.get().createTextNode("ABCDE");
    ContentNode node = new ContentTextNode(input, null);

    final Point<ContentNode> start = Point.inText(node, 1);
    final Point<ContentNode> end = Point.inText(node, 4);
    FakeEditorInteractor interactor = setupFakeEditorInteractor(
        new FocusedContentRange(start, end));
View Full Code Here

        move(hpoint(t1, 0)),
        type("abc"),
        split()
    );

    ContentTextNode t2 = c.createTextNode("hellothereandmore", root, null);
    typingSink.expectDelete(cpoint(t2, 3), 4);
    typingSink.expectInsert(cpoint(t2, 3), "abc");
    runSimpleTest(
        move(hpoint(t2,3)),
        type("abc"),
        split(),
        del(4)
    );


    ContentTextNode t3 = c.createTextNode("fishandchips", root, null);
    typingSink.expectDelete(cpoint(t3, 0), 3);
    runSimpleTest(
        move(hpoint(t3,3)),
        split(),
        bksp(3)
View Full Code Here

    m = dom.getContext().rendering().getNodeManager();

    String s1 = "some text", s2 = "other writings", s3 = "more information";

    // t1
    ContentTextNode t1 = c.createTextNode(s1, root, null);
    Text n1 = t1.getImplNodelet();
    checkWrapper(t1, n1);

    // b1 t1
    ContentElement b1 = c.createElement("b", root, t1);
    checkWrapper(t1, n1);

    // b1 t1 b2
    ContentElement b2 = c.createElement("b", root, null);
    checkWrapper(t1, n1);
    Text n1b = n1.splitText(2);
    checkWrapper(t1, n1b);

    // b1 t1 t2 b2
    ContentTextNode t2 = c.createTextNode(s2, root, b2);
    Text n2 = t2.getImplNodelet(), n2b;
    checkWrapper(t1, n1);
    checkWrapper(t1, n1b);
    n2b = n2.splitText(2);
    checkWrapper(t2, n2);
    checkWrapper(t2, n2b);
View Full Code Here

    m = dom.getContext().rendering().getNodeManager();

    // TODO(danilatos): Expand this and other test cases

    String s1 = "some text", s2 = "other writings", s3 = "more information";
    ContentTextNode t1 = c.createTextNode(s1, root, null);

    Text n1 = t1.getImplNodelet(), n1b;

    n1b = n1.splitText(1);
    n1b.setData(s1);
    n1.removeFromParent();
View Full Code Here

    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

              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

      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

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.