Examples of ContentElement


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

  public void cleanup(ContentElement e, Attachment a) {
    doodads.remove(a);
  }

  private ContentElement getElement(Attachment c) {
    ContentElement e = doodads.get(c);
    if (e != null) {
      if (!e.isContentAttached()) {
        // Lazy removal. Perhaps do it from the node mutation event handler?
        doodads.remove(c);
      } else {
        return e;
      }
View Full Code Here

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

    return null;
  }

  @Override
  public void onContentUpdated(Attachment c) {
    ContentElement e = getElement(c);
    // TODO(nigeltao): can e ever be null?
    if (e == null) {
      return;
    }
View Full Code Here

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

    }
  }

  @Override
  public void onThumbnailUpdated(Attachment c) {
    ContentElement e = getElement(c);
    if (e == null) {
      return;
    }

    if (c.isMalware()) {
View Full Code Here

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

    }
  }

  @Override
  public void onUploadStatusUpdated(Attachment c) {
    ContentElement e = getElement(c);
    if (e == null) {
      return;
    }

    ImageThumbnailView v = renderer.getView(e);
View Full Code Here

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

    /**
     * Notifies parent that this events node has changed, if parent implements
     */
    private void onContentEventsChanged(ContentElement element) {
      ContentElement parent = element.getParentElement();
      // TODO(user): Notify parent if parent cares.
    }
View Full Code Here

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

public class LocalParagraphEventHandler extends NodeEventHandlerImpl {

  boolean isEmptyLine(ContentElement e) {
    // The line containing element e is considered empty if its line element is the last
    // element or if it is followed by another line element
    ContentElement lineElement = Line.fromParagraph(e).getLineElement();
    CMutableDocument doc = lineElement.getMutableDoc();
    ContentNode next = doc.getNextSibling(lineElement);
    return next == null
        || (next.asElement() != null && LineRendering.isLineElement(next.asElement()));
  }
View Full Code Here

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

    // rewrite to null if no attributes
    if (secondAttrs.isEmpty()) {
      secondAttrs = Attributes.EMPTY_MAP;
    }

    ContentElement newLineElement = doc.createElement(
        doc.locate(doc.getLocation(point)), LineContainers.LINE_TAGNAME, secondAttrs);

    ContentElement newLocalParagraph = Line.fromLineElement(newLineElement).getParagraph();
    element.getSelectionHelper().setCaret(
        Point.start(element.getRenderedContentView(), newLocalParagraph));

    return true;
  }
View Full Code Here

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

  }

  @Override
  public boolean handleBackspaceAtBeginning(ContentElement paragraph, EditorEvent event) {
    Line line = Line.fromParagraph(paragraph);
    ContentElement lineElement = line.getLineElement();

    if (line.getIndent() > 0) {
      indent(lineElement, -1);
    } else {
      switch (line.getBehaviour()) {
        case LIST:
          lineElement.getMutableDoc().setElementAttribute(
              lineElement, Paragraph.SUBTYPE_ATTR, null);
          lineElement.getMutableDoc().setElementAttribute(
              lineElement, Paragraph.LIST_STYLE_ATTR, null);
          break;
        default:
          maybeRemove(line);
          break;
View Full Code Here

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

    return true;
  }

  private void maybeRemove(Line line) {
    MutableDocument<ContentNode, ContentElement, ContentTextNode> doc = line.getMutableDoc();
    ContentElement lineElement = line.getLineElement();
    Line previousLine = line.previous();
    if (previousLine != null) {
      ContentElement prevLineElement = previousLine.getLineElement();
      ContentElement prevParagraph = previousLine.getParagraph();
      if (doc.getNextSibling(prevLineElement) == lineElement) {
        // If the previous line is empty
        Map<String, String> attrs = doc.getAttributes(lineElement);
        doc.setElementAttributes(prevLineElement, new AttributesImpl(attrs));
      }

      int at = doc.getLocation(Point.<ContentNode>end(prevParagraph));
      boolean needsAdjusting = prevParagraph.getFirstChild() == null;
      doc.deleteNode(lineElement);

      if (!needsAdjusting) {
        lineElement.getSelectionHelper().setCaret(doc.locate(at));
      } else {
View Full Code Here

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

    try {

      DocumentContext<ContentNode, ContentElement, ContentTextNode> cxt =
        container.getContext();

      ContentElement element = child.asElement();
      if (element != null && isLineElement(element)) {
        Line line = new Line(cxt, element);
        ContentNode previousDirectSibling = child.getPreviousSibling();
        ContentNode previousPersistentSibling = container.getMutableDoc().getPreviousSibling(child);
        if (previousPersistentSibling == null) {
          insertAsFirstLine(container, line);
        } else {
          Line previousLine;
          if (element.getParentElement() == container) {
            // TODO(danilatos): Handle the case where this assertion fails.
            assert previousDirectSibling != null &&
                LineRendering.isLocalParagraph(previousDirectSibling);
            previousLine = Line.fromParagraph(previousDirectSibling.asElement());
          } else {
            previousLine = Line.fromParagraph(element.getParentElement());
          }

          // TODO(danilatos): Handle the case where this assertion fails too.
          assert previousLine != null;

          insertAfterLine(previousLine, line);
        }

        Line nextLine = line.next();
        ContentElement paragraph = line.getParagraph();

        if (element.getParentElement() != container) {
          cxt.annotatableContent().transparentMove(paragraph, paragraph.getNextSibling(),
              null, null);
          cxt.annotatableContent().transparentMove(container, paragraph, null,
              element.getParentElement().getNextSibling());
          cxt.annotatableContent().transparentMove(container, element, null,
              paragraph);
        }

      } else {
        ContentNode before = child.getPreviousSibling();
        ContentElement paragraph = before == null ? null : asParagraph(before);
        if (paragraph != null) {
          cxt.annotatableContent().transparentMove(paragraph, child, child.getNextSibling(), null);
        }
      }
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.