Package com.google.wave.api

Examples of com.google.wave.api.Blip


    contributorsAdded.add("bar@google.com");

    List<String> contributorsRemoved = new ArrayList<String>();
    contributorsRemoved.add("baz@google.com");

    Blip blip = mock(Blip.class);
    when(blip.getBlipId()).thenReturn("blip123");
    Wavelet wavelet = mock(Wavelet.class);
    when(wavelet.getBlip("blip123")).thenReturn(blip);
    EventMessageBundle bundle = new EventMessageBundle("http://10.1.1.1",
        "http://wave-active-api.example.com");
View Full Code Here


  public void testSerializeAndDeserializeGadgetStateChanged() throws Exception {
    Map<String, String> oldState = new HashMap<String, String>();
    oldState.put("key1", "value1");
    oldState.put("key2", "value2");

    Blip blip = mock(Blip.class);
    when(blip.getBlipId()).thenReturn("blip123");
    Wavelet wavelet = mock(Wavelet.class);
    when(wavelet.getBlip("blip123")).thenReturn(blip);
    EventMessageBundle bundle = new EventMessageBundle("http://10.1.1.1",
        "http://wave-active-api.example.com");
View Full Code Here

   */
  public PollWavelet(RobotMessageBundle context) {
    this.wavelet = context.getWavelet();
    this.metadata = new PollMetadata(context);
   
    Blip rootBlip = wavelet.getRootBlip();
    this.pollPane = new PreviewPane(rootBlip, metadata);
  }
View Full Code Here

  public AdminWavelet(RobotMessageBundle context) {
    this.context = context;
    this.wavelet = context.getWavelet();
    this.metadata = new PollMetadata(context);
   
    Blip rootBlip = wavelet.getRootBlip();
    this.adminPane = new AdminPane(rootBlip, metadata);
    this.previewPane = new PreviewPane(rootBlip, metadata);
    this.resultsPane = new ResultsPane(rootBlip, metadata);
  }
View Full Code Here

    blip.append(button);
  }

  private void processComments(final BlipSubmittedEvent event) {
    Wavelet wavelet = event.getWavelet();
    Blip blip = event.getBlip();

    if (blip.getBlipId().equals(wavelet.getRootBlipId())) {
      // This is triggered from root blip, skip comment processing.
      return;
    }

    String user = event.getModifiedBy();
View Full Code Here

  }

  @Override
  public void onFormButtonClicked(FormButtonClickedEvent event) {
    Wavelet wavelet = event.getWavelet();
    Blip blip = event.getBlip();
    if (event.getButtonName().equals("createIssue")) {
      String project = wavelet.getDataDocuments().get("issue-tracker-project");
      String title = wavelet.getTitle();
      String content = blip.getContent().replace(title, "");
      int issueId = submitNewIssue(project, event.getModifiedBy(), title, content, wavelet
          .getTags());
      if (issueId > 0) {
        util.persistJdo(new IssueJdoEntry(wavelet.getDomain(), blip, project, issueId));
        // Create a new blip with issue creation info.
        String issueWebLink = projectHostingHelper.getWebIssueEntryUrl(project, issueId);
        wavelet.setTitle(wavelet.getTitle() + " - " + issueWebLink);
        blip.all(ElementType.BUTTON, Restriction.of("name", "createIssue")).delete();
      } else {
        wavelet.reply("\nsubmitNewIssue failed()");
      }
    }
  }
View Full Code Here

    // newBlip.getDocument().delete();
  }

  @Override
  public void onDocumentChanged(DocumentChangedEvent event) {
    Blip blip = event.getBlip();
    Wavelet wavelet = event.getWavelet();

    if (wavelet.getDataDocuments().contains("issue-tracker-project")) {
      return;
    }

    Annotations annotations = event.getBlip().getAnnotations();
    Iterator<Annotation> iterator = annotations.iterator();
    while (iterator.hasNext()) {
      Annotation annotation = iterator.next();
      String name = annotation.getName();
      String value = annotation.getValue();
      if (name.equals(this.HIGHLIGHT_ANNOTATION_NAME) && value.equals("new")) {

        // Check for authsub token first
        String user = event.getModifiedBy();
        UserInfo userInfo = util.getUserInfo(user);
        if (userInfo == null) {
          appendAuthSubGadget(blip, user);
        } else {
          BlipContentRefs blipContentRefs = blip.range(annotation.getRange().getStart(), annotation
              .getRange().getEnd());
          blipContentRefs.annotate(this.HIGHLIGHT_ANNOTATION_NAME, "done");

          Set<String> participants = new HashSet<String>();
          participants.add(event.getModifiedBy());
View Full Code Here

   * key = "authSubCompleted".
   *
   * @param event
   */
  private void handleAuthSubCompleted(final GadgetStateChangedEvent event) {
    Blip blip = event.getBlip();

    Gadget gadget = Gadget.class.cast(blip.at(event.getIndex()).value());
    if (!gadget.getUrl().startsWith("http://" + this.getServerName() + "/authsub.xml")) {
      return;
    }
    String user = gadget.getProperty("authSubCompleted");
    if (user != null) {
      blip.at(event.getIndex()).delete();

      UserInfo userInfo = util.getUserInfo(user);
      if (userInfo != null) {
        if (blip.getBlipId().equals(event.getWavelet().getRootBlipId())) {
          // This is resulted from root blip, thus it is for submit new issue.
          //submitNewIssue(event);
        }
      } else {
        // TODO(austinchau) Handle error when gadget state update but no authsub
View Full Code Here

            HtmlTextConstruct htmlConstruct = (HtmlTextConstruct) textContent.getContent();
            content = htmlConstruct.getHtml();
          }
          String author = entry.getAuthors().get(0).getName();

          Blip newBlip = wavelet.reply("\n");
          newBlip.append("Comment #" + commentId + " from " + author);
          newBlip.append("\n\n" + content);
          robot.submit(wavelet, robot.getRpcServerUrl());
        }
      }

    } catch (Exception e) {
View Full Code Here

    gadget.setProperty("id", id);
 
 
  @Override
  public void onGadgetStateChanged(GadgetStateChangedEvent event) {
    Blip blip = event.getBlip();

    Gadget gadget = Gadget.class.cast(blip.at(event.getIndex()).value());
    if (!gadget.getUrl().startsWith(gadgetUrl)) {
      return;
    }
   
    if (gadget.getProperty("is-closed").equals("true")) {
      blip.at(event.getIndex()).delete();
    }
  } 
View Full Code Here

TOP

Related Classes of com.google.wave.api.Blip

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.