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

Examples of org.waveprotocol.wave.model.document.operation.DocOp$IsDocOp


     * @param op mutation to apply
     */
    @Override
    public void consume(Nindo op) {
      try {
        DocOp docOp = sink.consumeAndReturnInvertible(op);
        if (outputSink != null) {
          outputSink.consume(docOp);
        }
      } catch (OperationException e) {
        throw new OperationRuntimeException(
View Full Code Here


  /**
   * Creates an XmlDelete with the given data.
   */
  public WaveletOperation delete(int posStart, String characters, int remaining) {
    DocOp op = new DocOpBuilder()
        .retain(posStart)
        .deleteCharacters(characters)
        .retain(remaining)
        .build();
    BlipContentOperation blipOp = new BlipContentOperation(
View Full Code Here

   * Creates a random op. The result is unlikely to be applicable to any
   * wavelet, but is generated such that we are fairly certain that it will be
   * unique so we can identify it when it completes a round-trip.
   */
  private WaveletOperation randomOp(WaveletOperationContext context) {
    DocOp blipOp = new DocOpBuilder()
        .retain(Math.abs(random.nextInt()) / 2 + 1)
        .characters("createRndOp#" + random.nextInt())
        .build();
    return new WaveletBlipOperation("createRndId#" + random.nextInt(),
        new BlipContentOperation(context, blipOp));
View Full Code Here

    if (size() == 0) {
      return EmptyDocument.EMPTY_DOCUMENT;
    }

    DocOp domOp = serializeDom();

    DocOp annotationsOp = serializeAnnotations();

    try {
      final DocOp bothOps;
      if (performValidation) {
        bothOps = Composer.compose(domOp, annotationsOp);
      } else {
        bothOps = Composer.composeUnchecked(domOp, annotationsOp);
      }
View Full Code Here

          b.elementEnd();
        }
      }
    }

    DocOp domOp = b.buildUnchecked();
    assert DocOpValidator.isWellFormed(null, domOp);
    return domOp;
  }
View Full Code Here

  //          assert value != null;
            b.endAnnotation(key);
          }
        });
    }
    DocOp annotationsOp = b.finish();
    assert DocOpValidator.isWellFormed(null, annotationsOp);
    return annotationsOp;
  }
View Full Code Here

      this.saveSelection = saveSelection;
    }

    @Override
    public DocOp consumeAndReturnInvertible(Nindo op) {
      DocOp docOp = consumeLocal(op, saveSelection);
      outgoingOperationSink.consume(docOp);
      return docOp;
    }
View Full Code Here

    // create op, wrapping the tree operations within retains.
    DocOpBuffer opBuffer = new DocOpBuffer();
    safeRetain(opBuffer, position);
    DomOperationUtil.buildDomInitializationFromSubtree(localDoc, localNode, opBuffer);
    safeRetain(opBuffer, remainder);
    DocOp op = opBuffer.finish();

    // fake out the node creation, and consume:
    nodeCreationDelegate =
      new ReadableTreeWalker<ContentNode, ContentElement, ContentTextNode>(localDoc, localNode);
    sink.consume(op);
View Full Code Here

    }
    if (newestBlip == null) {
      // Render whatever data we have and hope its good enough
      sb.append(collateTextForWavelet(wavelet));
    } else {
      DocOp docOp = newestBlip.getContent().asOperation();
      sb.append(collateTextForOps(Lists.newArrayList(docOp)));
      sb.append(" ");
      docOp.apply(InitializationCursorAdapter.adapt(new DocInitializationCursor() {
        @Override
        public void annotationBoundary(AnnotationBoundaryMap map) {
        }

        @Override
View Full Code Here

          }
          continue;
      }
    }

    DocOp op = builder.build();
    return DocOpUtil.asInitialization(op);
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.DocOp$IsDocOp

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.