Package org.waveprotocol.wave.model.document

Examples of org.waveprotocol.wave.model.document.Document


    assertNull("Expected this text not to be annotated",
        getRootBlip().getContent().getAnnotation(CONTENT_START_XML + 1, ANNOTATION_KEY));
  }

  public void testClearAnnotatation() throws Exception {
    Document doc = getRootBlip().getContent();
    doc.setAnnotation(CONTENT_START_XML, CONTENT_START_XML + 1, ANNOTATION_KEY, ANNOTATION_VALUE);

    String annotation = getRootBlip().getContent().getAnnotation(CONTENT_START_XML, ANNOTATION_KEY);
    assertEquals("Expected the text to be annotated", ANNOTATION_VALUE, annotation);

    OperationRequest operation =
View Full Code Here


        conversation.getRootThread().getFirstBlip().locateReplyThreads().iterator();
    LocatedReplyThread<? extends ObservableConversationThread> inlineReplyThread = it.next();

    // The inline reply thread should be located just after the last line
    // element
    Document doc = conversation.getRootThread().getFirstBlip().getContent();
    Doc.E lastLine = DocHelper.getLastElementWithTagName(doc, LineContainers.LINE_TAGNAME);
    int lastLineLocation = doc.getLocation(Point.after(doc, lastLine));
    assertEquals("The inline reply was not located just after the last line element",
        lastLineLocation, inlineReplyThread.getLocation());
  }
View Full Code Here

      context.openConversation(WAVE_ID, WAVELET_ID, ALEX).getRoot();

    // Make an inline blip at a certain location, we will then have the
    // BlipOperationService insert one after that blip.
    ObservableConversationBlip rootBlip = conversation.getRootThread().getFirstBlip();
    Document doc = rootBlip.getContent();
    Doc.E lastLine = DocHelper.getLastElementWithTagName(doc, LineContainers.LINE_TAGNAME);
    int lastLineLocation = doc.getLocation(Point.after(doc, lastLine));
    ObservableConversationBlip firstInlineBlip =
        rootBlip.addReplyThread(lastLineLocation).appendBlip();

    // Append the inline blip to the root blip
    String rootBlipId = ConversationUtil.getRootBlipId(conversation);
View Full Code Here

    BlipData blipData = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_DATA);
    String parentBlipId = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_ID);
    ConversationBlip parentBlip = context.getBlip(conversation, parentBlipId);

    // Append a new, empty line to the doc for the inline anchor.
    Document doc = parentBlip.getContent();
    Doc.E line = LineContainers.appendLine(doc, XmlStringBuilder.createEmpty());

    // Insert new inline thread with the blip at the empty sentence.
    int location = doc.getLocation(Point.after(doc, line));
    ConversationBlip newBlip = parentBlip.addReplyThread(location).appendBlip();
    context.putBlip(blipData.getBlipId(), newBlip);

    putContentForNewBlip(newBlip, blipData.getContent());
    processBlipCreatedEvent(operation, context, participant, conversation, newBlip);
View Full Code Here

    // Create builder from xml content.
    XmlStringBuilder markupBuilder = XmlStringBuilder.createFromXmlString(content);

    // Append the new markup to the blip doc.
    Document doc = convBlip.getContent();
    LineContainers.appendLine(doc, markupBuilder);

    // Report success.
    context.constructResponse(operation, Maps.<ParamsProperty, Object> newHashMap());
  }
View Full Code Here

   * @param sourceWavelet the source wavelet
   * @param destWavelet the destination wavelet
   * @param docId the id of the document to copy
   */
  public static void copyDocument(Wavelet sourceWavelet, Wavelet destWavelet, String docId) {
    Document document = sourceWavelet.getDocument(docId);
    DocInitialization docInit = document.toInitialization();
    // TODO(user): add a createDocument method to Wavelet so that we can push this ugliness
    // down the stack.
    ObservableDocument destDoc = destWavelet.getDocument(docId);
    destDoc.hackConsume(Nindo.fromDocOp(docInit, false /* don't remove skip */));
  }
View Full Code Here

   *
   * @param wavelet the wavelet containing the document to erase
   * @param documentId the id of the document to erase
   */
  public static void clearDocument(Wavelet wavelet, String documentId) {
    Document document = wavelet.getDocument(documentId);
    if (document.size() != 0) {
      document.emptyElement(document.getDocumentElement());
    }
  }
View Full Code Here

    String title =
        OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVELET_TITLE);
    ObservableConversation conversation =
        context.openConversation(operation, participant).getRoot();
    String blipId = conversation.getRootThread().getFirstBlip().getId();
    Document doc = context.getBlip(conversation, blipId).getContent();
    TitleHelper.setExplicitTitle(doc, title);
  }
View Full Code Here

    // ignored for now.
    for (String documentId : wavelet.getDocumentIds()) {
      if (IdUtil.isRobotDocId(documentId)) {
        String[] parts = IdUtil.split(documentId);
        if (parts.length == 2) {
          Document document = wavelet.getDocument(documentId);
          String val = XmlStringBuilder.innerXml(document).getXmlString();
          waveletData.setDataDocument(parts[1], val);
        }
      }
    }
View Full Code Here

    }
    ConversationBlip firstBlip = rootThread.getFirstBlip();
    if (firstBlip == null) {
      return "";
    }
    Document doc = firstBlip.getContent();
    return TitleHelper.extractTitle(doc);
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.Document

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.