Every Document Operation is always an edit operation. Insertion of
characters, deletion of some text or the creation of a new blip are
all edit operations on a document. That is why in the
createAppendBlipDelta(), besides sending the operation newBlipOp that
creates the blip with the given text, the client also sends an empty
DocOp so the server and other clients can detect this isn't just an
edit operation but it is the creation of a new blip.

That being said, to detect it is an edit you just don't send the empty DocOp.

You might also want to look at the createTextInsertion function. It
creates a DocOp that inserts a given text at a given index.

On Sat, Apr 10, 2010 at 5:50 PM, Devon <[email protected]> wrote:
> I'm using the ClientConsole source to to create an application, and
> I'm having trouble creating a DocOp to edit the root blip of a wave.
> There isn't much information about how DocOp's work in the source- how
> can I create one to edit the contents of a blip?
>
> I was working with the createAppendBlipDelta() method in ClientUtils,
> with this block, but I don't know how to make it get detected as an
> edit instead of creating a new blip:
>
>      BufferedDocOp newBlipOp = new DocOpBuilder()
>          .elementStart(DocumentConstants.BODY, Attributes.EMPTY_MAP)
>          .elementStart(DocumentConstants.LINE, Attributes.EMPTY_MAP)
>          .elementEnd() // </line>
>          .characters(text)
>          .elementEnd() // </body>
>          .build();
>
>      // An empty doc op to indicate a new blip is being created.
>      BufferedDocOp emptyNewBlipOp = new DocOpBuilder().build();
>
>      // Send the operation.
>      ImmutableList<WaveletDocumentOperation> operations =
> ImmutableList.of(
>          new WaveletDocumentOperation(newBlipId, emptyNewBlipOp),
>          new WaveletDocumentOperation(newBlipId, newBlipOp),
>          appendToManifest(manifestDocument, newBlipId));
>      return new WaveletDelta(author, operations);
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Wave Protocol" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/wave-protocol?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Wave 
Protocol" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/wave-protocol?hl=en.

Reply via email to