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

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


    Point<ContentNode> point = mapper.locate(start);
    CMutableDocument doc = point.getContainer().getMutableDoc();
    LineContainers.checkNotParagraphDocument(doc);

    // get line element we are in:
    ContentNode first = LineContainers.getRelatedLineElement(doc, point);

    if (first == null) {
      return null;
    }

    // go through the lines one by one:
    return Line.fromLineElement(first.asElement());
  }
View Full Code Here


   * Rescans all gadget children to update the values stored in the gadget
   * object.
   */
  private void rescanGadgetXmlElements() {
    log("Rescanning elements");
    ContentNode childNode = element.getFirstChild();
    while (childNode != null) {
      processChild(GadgetElementChild.create(childNode));
      childNode = childNode.getNextSibling();
    }
  }
View Full Code Here

      SelectionMatcher selectionMatcher) {

    Preconditions.checkArgument(firstItem instanceof ContentElement,
        "firstItem must be an instance of ContentElement ", firstItem.getClass());

    ContentNode prev = null;
    HtmlStack helper = new HtmlStack(destParent);

    for (ContentNode node = firstItem;
         node != null && node != stopAt;
         prev = node, node = view.getNextSibling(node)) {
View Full Code Here

    Point<ContentNode> point = mapper.locate(start);
    CMutableDocument doc = point.getContainer().getMutableDoc();
    LineContainers.checkNotParagraphDocument(doc);

    // get line element we are in:
    ContentNode first = LineContainers.getRelatedLineElement(doc, point);

    if (first == null) {
      return null;
    }

    // go through the lines one by one:
    return Line.fromLineElement(first.asElement());
  }
View Full Code Here

    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

    // Valid position for cursor, so stop where we are:
    if (!isKnownInvalidTopContainerForCursor(container)) {
      return point;
    }

    ContentNode nodeAfter = point.getNodeAfter();
    ContentNode newContainer;

    if (nodeAfter == null) {
      // place the cursor in the right-most valid child of the current container
      newContainer = validContainerView.getLastChild(container);
    } else {
      // we want to place the cursor at the end of the previous node
      newContainer = validContainerView.getVisibleNodePrevious(nodeAfter);
      if (newContainer != null) {
        // Special-case: if nodeAfter is already valid, find the previous valid point:
        if (newContainer.equals(nodeAfter)) {
          // Check to see if we've found ourselves before a visible, valid point:
          newContainer = validContainerView.getVisibleNodePrevious(nodeAfter.getParentElement());
          if (newContainer == nodeAfter.getParentElement()) {
            return Point.before(validContainerView, nodeAfter);
          }
View Full Code Here

  /** {@inheritDoc} */
  public Point<ContentNode> getFirstValidSelectionPoint() {
    ContentElement root = renderedContentView.getDocumentElement();
    // Must use filtered view, because of assertion in findOrCreateValidSelectionPoint
    ContentNode first = renderedContentView.getFirstChild(root);

    // assert there's no transparent wrapper, which would render the point invalid
    // for many uses
    assert first == null || first.getParentElement() == root;

    Point<ContentNode> point = findOrCreateValidSelectionPoint(Point.inElement(root, first));
    if (point == null) {
      throw new RuntimeException("Could not create a valid selection point!");
    }
View Full Code Here

        // 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();
        htmlRange = RestrictedRange.between(
            htmlNodeBefore, Point.inElement(htmlParent, htmlNodeAfter));

        if (partOfMutatingRange(filteredHtml.asText(previousSelectionStart.getContainer()))) {
          // This must be true if getWrapper worked correctly. Program error
View Full Code Here

        // TODO(patcoleman): see if being zero here is actually a problem.
        // assert selNode.getLength() > 0;

        if (selOffset == 0 && firstWrapper.getImplNodelet() == selNode) {
          // if we are at beginning of mutating node
          ContentNode prev = renderedContent.getPreviousSibling(firstWrapper);
          if (prev != null && prev.isTextNode()) {
            firstWrapper = (ContentTextNode)prev;
          }
        } else {
          ContentNode nextNode = renderedContent.getNextSibling(lastWrapper);
          Node nextNodelet = nextNode != null ? nextNode.getImplNodelet() : null;
          if (selOffset == selNode.getLength() &&
              filteredHtml.getNextSibling(selNode) == nextNodelet) {
            // if we are at end of mutating node
            if (nextNode != null && nextNode.isTextNode()) {
              lastWrapper = (ContentTextNode)nextNode;
            }
          }
        }
      } finally {
View Full Code Here

    }

    if (keySignalType == KeySignalType.DELETE) {
      refreshEditorWithCaret(event);
      caret = cachedSelection.getFocus();
      ContentNode node = caret.getContainer();

      editorInteractor.checkpoint(new FocusedContentRange(caret));

      switch (EventWrapper.getKeyCombo(event)) {
        case BACKSPACE:
View Full Code Here

TOP

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

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.