Package org.waveprotocol.wave.model.conversation

Examples of org.waveprotocol.wave.model.conversation.ConversationBlip


    if (rootBlip == null) {
      Conversation conversation  = wave.getRoot();
      if (conversation == null) {
        return null;
      } else {
        ConversationBlip blip = wave.getRoot().getRootThread().getFirstBlip();
        BlipView rootBlipUi = views.getBlipView(blip);
        if (rootBlipUi == null) {
          return null;
        }
        rootBlip =  rootBlipUi;
View Full Code Here


      conversation = wave.getRoot();
    }
    if (conversation == null) {
      return null;
    } else {
      ConversationBlip blip = null;
      // If there's blip reference then focus on that blip.
      // Find selected blip.
      if (documentId != null) {
        blip = wave.getRoot().getBlip(documentId);
        if (blip != null) {
View Full Code Here

  private BlipView findMostRecentlyModified(BlipView start) {
    BlipView blipUi = start;
    Map<Long, BlipView> blips = CollectionUtils.newHashMap();
    while (blipUi != null) {
      ConversationBlip blip = views.getBlip(blipUi);
      blips.put(blip.getLastModifiedTime() , blipUi);
      blipUi = traverser.getNext(blipUi);
    }
    long lmt = Collections.max(blips.keySet());
    return blips.get(lmt);
  }
View Full Code Here

    wavelet.removeListener(remoteChangeDetector);
  }

  private void onRemoteChange(Blip raw) {
    // Some op caused by someone else occurred. Stop auto-reading.
    ConversationBlip blip = rawAutoRead.get(raw);
    if (blip != null && blip != reading) {
      stopAutoReading(blip);
    }
  }
View Full Code Here

        OperationUtil.getOperationType(operation) == OperationType.BLIP_CONTINUE_THREAD,
        "Unsupported operation " + operation);

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

    ConversationBlip newBlip = parentBlip.getThread().appendBlip();
    context.putBlip(blipData.getBlipId(), newBlip);

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

        OperationUtil.getOperationType(operation) == OperationType.BLIP_CREATE_CHILD,
        "Unsupported operation " + operation);

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

    ConversationBlip newBlip = parentBlip.addReplyThread().appendBlip();
    context.putBlip(blipData.getBlipId(), newBlip);

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

        OperationUtil.getOperationType(operation) == OperationType.DOCUMENT_APPEND_INLINE_BLIP,
        "Unsupported operation " + operation);

    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

        OperationUtil.getOperationType(operation) == OperationType.DOCUMENT_APPEND_MARKUP,
        "Unsupported operation " + operation);

    String content = OperationUtil.getRequiredParameter(operation, ParamsProperty.CONTENT);
    String blipId = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_ID);
    ConversationBlip convBlip = context.getBlip(conversation, blipId);

    // 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

        OperationUtil.getOperationType(operation) == OperationType.DOCUMENT_INSERT_INLINE_BLIP,
        "Unsupported operation " + operation);

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

    Integer index = OperationUtil.getRequiredParameter(operation, ParamsProperty.INDEX);
    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);

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

        == OperationType.DOCUMENT_INSERT_INLINE_BLIP_AFTER_ELEMENT,
        "Unsupported operation " + operation);

    BlipData blipData = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_DATA);
    String parentBlipId = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_ID);
    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);

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

TOP

Related Classes of org.waveprotocol.wave.model.conversation.ConversationBlip

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.