Package com.google.wave.api

Examples of com.google.wave.api.Gadget


 
  private String gadgetUrl = String.format("http://%s.appspot.com/gadget/content.xml", ROBOT_ID);
 
  @Override
  public void onWaveletSelfAdded(WaveletSelfAddedEvent event) {   
    Gadget gadget = new Gadget(gadgetUrl);
    event.getWavelet().getRootBlip().append(gadget);   
    String id = event.getWavelet().getDomain() + "!" + event.getWavelet().getWaveId().getId();   
    gadget.setProperty("id", id);
 
View Full Code Here


 
  @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

    // Invoked when any blip we are interested in is submitted.
    LOG.info("onBlipSubmitted");
    Blip blip = e.getBlip();

    String gadgetUrl = "http://jkitchensinky.appspot.com/public/embed.xml";
    Gadget gadget = Gadget.class.cast(blip.first(ElementType.GADGET,
        Gadget.restrictByUrl(gadgetUrl)).value());
    if (gadget != null &&
        gadget.getProperty("loaded", "no").equals("yes") &&
        gadget.getProperty("seen", "no").equals("no")) {
      // Elements should always be updated through a BlipContentRefs to
      // correspond the matching operations for the wire.
      blip.first(ElementType.GADGET, Gadget.restrictByUrl(gadgetUrl)).updateElement(
          ImmutableMap.of("seen", "yes"));
      blip.append("\nSeems all to have worked out.");
View Full Code Here

    Blip rootBlip = Blip.deserialize(operationQueue, originalWavelet, blipData);
    blips.put(rootBlip.getBlipId(), rootBlip);

    // Add a gadget that embeds the newly created wave to the original wavelet.
    Gadget gadget = new Gadget("http://jkitchensinky.appspot.com/public/embed.xml");
    gadget.setProperty("waveid", e.getWavelet().getWaveId().serialise());
    originalWavelet.getRootBlip().append(gadget);

    // Insert some non-standard characters.
    String unicodeString = "\u0430\u0431\u0432";
    originalWavelet.getRootBlip().append("\nInserted a gadget: " + unicodeString);
View Full Code Here

      return toInsert.length();
    } else {
      Element element = modifyAction.getElement(valueIndex);
      if (element != null) {
        if (element.isGadget()) {
          Gadget gadget = (Gadget) element;
          XmlStringBuilder xml =
              GadgetXmlUtil.constructXml(gadget.getUrl(), "", gadget.getAuthor(), null,
                  gadget.getProperties());
          // TODO (Yuri Z.) Make it possible to specify a location to insert the
          // gadget and implement insertion at the specified location.
          LineContainers.appendLine(doc, xml);
        } else {
          // TODO(ljvderijk): Inserting other elements.
View Full Code Here

      gadgetString = gadgetUrl + "?" + URLEncoder.encode("key", CHARACTER_ENCODING) + "="
          + URLEncoder.encode(userRecordKey, CHARACTER_ENCODING);
    } catch (UnsupportedEncodingException e) {
      LOG.warning(e.toString());
    }
    Gadget gadget = new Gadget(gadgetString);
    LOG.info(gadgetString);
    wavelet.getRootBlip().append(gadget);
  }
View Full Code Here

        json.getAsJsonObject().get(PROPERTIES_TAG), GsonFactory.STRING_MAP_TYPE);

    if (FormElement.getFormElementTypes().contains(type)) {
      result = new FormElement(type, properties);
    } else if (type == ElementType.GADGET) {
      result = new Gadget(properties);
    } else if (type == ElementType.IMAGE) {
      result = new Image(properties);
    } else if (type == ElementType.ATTACHMENT) {
      byte[] data = null;
      String encodedData = properties.get(Attachment.DATA);
View Full Code Here

TOP

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

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.