Examples of CMutableDocument


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

   * Builds a string representation of the annotations in the current document.
   *
   * @return formatted string of all the annotations in the document
   */
  private String getAnnotations() {
    CMutableDocument doc = editorImpl.mutable();
    int end = doc.size();
    // Grab a cursor over the whole document for our known keys
    Iterable<RangedAnnotation<Object>> rangedAnnotations =
        editorImpl.getContent().getLocalAnnotations().rangedAnnotations(0, end, null);
    StringBuilder retval = new StringBuilder();
    for (RangedAnnotation<Object> ann : rangedAnnotations) {
View Full Code Here

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

   * effect only when the first line of the root blip is edited and no explicit
   * title is set.
   */
  private void maybeSetOrUpdateTitle() {
    if (blipUi != null && editor != null) {
      CMutableDocument document = editor.getDocument();
      ConversationBlip editBlip = views.getBlip(blipUi);
      if (editBlip.isRoot() && !TitleHelper.hasExplicitTitle(document)) {
        Range titleRange = TitleHelper.findImplicitTitle(document);
        TitleHelper.setImplicitTitle(document, titleRange.getStart(), titleRange.getEnd());
      }
View Full Code Here

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

  }

  @Override
  public void selectGadget() {
    if (isActive()) {
      CMutableDocument doc = element.getMutableDoc();
      element.getSelectionHelper().setSelectionPoints(
          Point.before(doc, element), Point.after(doc, element));
    }
  }
View Full Code Here

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

  /**
   * Sets the caption text of this doodad.
   */
  public void setCaptionText(String text) {
    CMutableDocument doc = element.getMutableDoc();
    ContentElement caption = DocHelper.getElementWithTagName(doc, Caption.TAGNAME, element);
    if (caption != null) {
      doc.emptyElement(caption);
      doc.insertText(Point.<ContentNode> end(caption), text);
    }
  }
View Full Code Here

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

  /**
   * Gets the text of the image caption
   */
  public String getCaptionText() {
    CMutableDocument doc = element.getMutableDoc();
    return DocHelper.getText(doc, doc, doc.getLocation(element),
        doc.getLocation(Point.end((ContentNode) element)));
  }
View Full Code Here

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

    // operations that have not yet been extracted by the typing extractor. The
    // problem is that we can't always safely force the typing extractor to
    // extract out those operations. Therefore, we assume that most of the time,
    // doodads are inserted via selection on a non-editing document.
    ContentRange selectionPoints = createSelectionHelper(content).getOrderedSelectionPoints();
    CMutableDocument document = content.getMutableDoc();
    ContentView view = content.getPersistentView();
    return DocumentUtil.getLocationNearSelection(document, view, selectionPoints);
  }
View Full Code Here

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

  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.CMutableDocument

    Map<String, String> secondAttrs = new HashMap<String, String>();

    // TODO(patcoleman): use StringMap<String> instead?
    // copy whitelisted attributes
    CMutableDocument doc = element.getMutableDoc();
    Map<String, String> currentAttrs = line.getAttributes();
    if (currentAttrs != null) {
      for (Entry<String, String> entry : currentAttrs.entrySet()) {
        if (attributeKeptOnNewline(entry.getKey(), entry.getValue())) {
          secondAttrs.put(entry.getKey(), entry.getValue());
        }
      }
    }

    // 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));
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.