Package org.waveprotocol.wave.model.document.operation.impl

Examples of org.waveprotocol.wave.model.document.operation.impl.DocInitializationBuilder


    long time = 1234567890;

    WaveletData wavelet = WaveletDataUtil.createEmptyWavelet(name, creator,
        HashedVersion.unsigned(0), time);

    DocInitialization content = new DocInitializationBuilder().characters("Hello there").build();
    wavelet.createDocument(
        "b+abc123", creator, Collections.<ParticipantId> emptySet(), content, time, 0);

    return wavelet;
  }
View Full Code Here


   * @param contentText The content that the document should have.
   * @return The document with the given content.
   */
  public static DocInitialization createContent(String contentText) {
    if (contentText.isEmpty()) {
      return (new DocInitializationBuilder())
          .elementStart("body", new AttributesImpl())
          .elementStart("line", new AttributesImpl())
          .elementEnd()
          .elementEnd()
          .build();
    } else {
      return new DocInitializationBuilder()
          .elementStart("body", new AttributesImpl())
          .elementStart("line", new AttributesImpl())
          .elementEnd()
          .characters(contentText)
          .elementEnd()
View Full Code Here

  /**
   * Stand-alone main() for quick experimentation.
   */
  public static void main(String[] args) throws OperationException {
    BootstrapDocument initialDoc = new BootstrapDocument();
    initialDoc.consume(new DocInitializationBuilder()
        .elementStart("blip", Attributes.EMPTY_MAP)
        .elementStart("p", Attributes.EMPTY_MAP)
        .characters("abc")
        .elementEnd()
        .elementEnd().build());
View Full Code Here

    ObservableWaveView waveView = BasicFactories.fakeWaveViewBuilder().with(idGenerator).build();
    ConversationView convView = WaveBasedConversationView.create(waveView, idGenerator);
    Conversation conversation = convView.createRoot();
    // Force empty document.
    ConversationBlip blip = conversation.getRootThread().appendBlip(
        new DocInitializationBuilder().build());
    Document document = blip.getContent();
    document.appendXml(Blips.INITIAL_BODY);
    return conversation;
  }
View Full Code Here

    IdGenerator idGenerator = FakeIdGenerator.create();
    ObservableWaveView waveView = BasicFactories.fakeWaveViewBuilder().with(idGenerator).build();
    ConversationView convView = WaveBasedConversationView.create(waveView, idGenerator);
    Conversation conversation = convView.createRoot();
    // Force empty document.
    conversation.getRootThread().appendBlip(new DocInitializationBuilder().build());
    return conversation;
  }
View Full Code Here

      throw new InvalidInputException("Fell through in applyComponent: " + component);
    }
  }

  public static DocInitialization deserializeContent(GoogleDocumentContent in) {
    DocInitializationBuilder out = new DocInitializationBuilder();
    for (Component component : in.getComponentList()) {
      applyComponent(component, out);
    }
    return out.build();
  }
View Full Code Here

   * @param contentText The content that the document should have.
   * @return The document with the given content.
   */
  public static DocInitialization createContent(String contentText) {
    if (contentText.isEmpty()) {
      return (new DocInitializationBuilder())
          .elementStart("body", new AttributesImpl())
          .elementStart("line", new AttributesImpl())
          .elementEnd()
          .elementEnd()
          .build();
    } else {
      return new DocInitializationBuilder()
          .elementStart("body", new AttributesImpl())
          .elementStart("line", new AttributesImpl())
          .elementEnd()
          .characters(contentText)
          .elementEnd()
View Full Code Here

   * Creates a document which applies generated operations to a copy of
   * itself, thus ensuring those ops are valid when received remotely.
   */
  public static Document createValidatingDocument(DocumentSchema schema) {
    IndexedDocument<Node, Element, Text> indexedDoc =
        POJO.build(new DocInitializationBuilder().build(), schema);
    return new DocumentImpl(createCopyingSequencer(indexedDoc), indexedDoc);
  }
View Full Code Here

  /**
   * Stand-alone main() for quick experimentation.
   */
  public static void main(String[] args) throws OperationException {
    BootstrapDocument initialDoc = new BootstrapDocument();
    initialDoc.consume(new DocInitializationBuilder()
        .elementStart("blip", Attributes.EMPTY_MAP)
        .elementStart("p", Attributes.EMPTY_MAP)
        .characters("abc")
        .elementEnd()
        .elementEnd().build());
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.impl.DocInitializationBuilder

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.