Package com.google.wave.api.data

Examples of com.google.wave.api.data.ApiView$Bit


    String after = getApiView().apiContents().substring(1);
    assertEquals("The entire text should be replaced", replacement, after);
  }

  private ApiView getApiView() throws InvalidRequestException {
    ApiView view = new ApiView(
        getRootBlip().getContent(), helper.getContext().openWavelet(WAVE_ID, WAVELET_ID, ALEX));
    return view;
  }
View Full Code Here


    OpBasedWavelet wavelet = context.openWavelet(WAVE_ID, WAVELET_ID, ALEX);
    ObservableConversation conversation =
        context.openConversation(WAVE_ID, WAVELET_ID, ALEX).getRoot();

    int insertAtApiLocation = 2;
    ApiView apiView =
        new ApiView(conversation.getRootThread().getFirstBlip().getContent(), wavelet);
    int insertAtXmlLocation = apiView.transformToXmlOffset(insertAtApiLocation);

    // Append the inline blip to the root blip
    String rootBlipId = ConversationUtil.getRootBlipId(conversation);
    OperationRequest operation = operationRequest(OperationType.DOCUMENT_INSERT_INLINE_BLIP,
        rootBlipId, Parameter.of(ParamsProperty.BLIP_DATA, blipData),
View Full Code Here

      }    
    }

    // Use ApiView to convert the offset.
    if (location != -1) {
      ApiView apiView = new ApiView(parent.getContent(), wavelet);
      location = apiView.transformToTextOffset(location);
    }

    // Get the ids of the contained blips.
    List<String> blipIds = Lists.newLinkedList();
    for (ConversationBlip blip : thread.getBlips()) {
View Full Code Here

    if (index <= 0) {
      throw new InvalidRequestException(
          "Can't inline a blip on position <= 0, got " + index, operation);
    }

    ApiView view = new ApiView(parentBlip.getContent(), wavelet);
    int xmlLocation = view.transformToXmlOffset(index);

    // Insert new inline thread with the blip at the location as specified.
    ConversationBlip newBlip = parentBlip.addReplyThread(xmlLocation).appendBlip();
    context.putBlip(blipData.getBlipId(), newBlip);
View Full Code Here

    ConversationBlip parentBlip = context.getBlip(conversation, parentBlipId);

    Element element = OperationUtil.getRequiredParameter(operation, ParamsProperty.ELEMENT);

    // view.locateElement will tell where the element actually is.
    ApiView view = new ApiView(parentBlip.getContent(), wavelet);
    int elementApiLocation = view.locateElement(element);

    if (elementApiLocation == -1) {
      throw new InvalidRequestException("Requested element not found", operation);
    }

    // Insert just after the requested element
    int xmlLocation = view.transformToXmlOffset(elementApiLocation + 1);

    // Insert new inline thread with the blip at the location of the element.
    ConversationBlip newBlip = parentBlip.addReplyThread(xmlLocation).appendBlip();
    context.putBlip(blipData.getBlipId(), newBlip);
View Full Code Here

    blipData.setParentBlipId(parentBlip == null ? null : parentBlip.getId());
    blipData.setWaveId(ApiIdSerializer.instance().serialiseWaveId(wavelet.getWaveId()));
    blipData.setWaveletId(ApiIdSerializer.instance().serialiseWaveletId(wavelet.getId()));
    blipData.setChildBlipIds(toBlipIdList(findBlipChildren(blip)));

    ApiView apiView = new ApiView(blip.getContent(), wavelet);
    // Set content.
    blipData.setContent(apiView.apiContents());
    // Set Annotations.
    blipData.setAnnotations(extractAnnotations(blip.getContent(), apiView));
    // blip.getContent().rangedAnnotations(0, blip.getContent().size(), null),
    // Set Form Elements.
    blipData.setElements(ElementSerializer.serialize(blip.getContent(), wavelet));
View Full Code Here

    OpBasedWavelet wavelet = context.openWavelet(operation, participant);
    ObservableConversation conversation =
        context.openConversation(operation, participant).getRoot();
    Document doc = context.getBlip(conversation, blipId).getContent();

    ApiView view = new ApiView(doc, wavelet);
    DocumentHitIterator hitIterator = getDocumentHitIterator(operation, view);

    switch (modifyAction.getModifyHow()) {
      case ANNOTATE:
        annotate(operation, doc, view, hitIterator, modifyAction);
View Full Code Here

    if (index <= 0) {
      throw new InvalidRequestException(
          "Can't inline a blip on position <= 0, got " + index, operation);
    }

    ApiView view = new ApiView(parentBlip.getContent(), wavelet);
    int xmlLocation = view.transformToXmlOffset(index);

    // Insert new inline thread with the blip at the location as specified.
    ConversationBlip newBlip = parentBlip.addReplyThread(xmlLocation).appendBlip();
    context.putBlip(blipData.getBlipId(), newBlip);
View Full Code Here

    ConversationBlip parentBlip = context.getBlip(conversation, parentBlipId);

    Element element = OperationUtil.getRequiredParameter(operation, ParamsProperty.ELEMENT);

    // view.locateElement will tell where the element actually is.
    ApiView view = new ApiView(parentBlip.getContent(), wavelet);
    int elementApiLocation = view.locateElement(element);

    if (elementApiLocation == -1) {
      throw new InvalidRequestException("Requested element not found", operation);
    }

    // Insert just after the requested element
    int xmlLocation = view.transformToXmlOffset(elementApiLocation + 1);

    // Insert new inline thread with the blip at the location of the element.
    ConversationBlip newBlip = parentBlip.addReplyThread(xmlLocation).appendBlip();
    context.putBlip(blipData.getBlipId(), newBlip);
View Full Code Here

    OpBasedWavelet wavelet = context.openWavelet(operation, participant);
    ObservableConversation conversation =
        context.openConversation(operation, participant).getRoot();
    Document doc = context.getBlip(conversation, blipId).getContent();

    ApiView view = new ApiView(doc, wavelet);
    DocumentHitIterator hitIterator = getDocumentHitIterator(operation, view);

    switch (modifyAction.getModifyHow()) {
      case ANNOTATE:
        annotate(operation, doc, view, hitIterator, modifyAction);
View Full Code Here

TOP

Related Classes of com.google.wave.api.data.ApiView$Bit

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.