First Google Wave experiments

October 7, 2009 at 10:16 pm | Posted in Programming | 9 Comments

I did some initial experiments with programming for Google Wave. Basically I got the code from the tutorial and created a robot (called Dalek) which automatically translates the entered text (so called blips) from English to Spanish using the Java version of the Google Translate API. Screenshot of the result:

My first wave

My first wave

Overall impression so far: very easy to use API. Google Wave itself can be terribly slow. Sometimes the syncing of ‘unsynced waves’ takes more than a minute. Next step: thinking of a more serious application.

And for those interested, the actual Java code:

package dalek;


public class DalekServlet extends AbstractRobotServlet {

   public void processEvents(RobotMessageBundle bundle) {
      Wavelet wavelet = bundle.getWavelet();

      if (bundle.wasSelfAdded()) {
         addText(wavelet, "We are the Daleks");

      for (Event e : bundle.getEvents()) {
         if (e.getType() == EventType.WAVELET_PARTICIPANTS_CHANGED) {
            addText(wavelet, "Exterminate... exterminate... exterminate");
         } else if (e.getType() == EventType.BLIP_SUBMITTED) {

   private void addTranslation(Blip blip) {
      if (!blip.getCreator().equals("")) {
         String originalText = blip.getDocument().getText();
         try {

            String translatedText = Translate.execute(originalText, Language.AUTO_DETECT, Language.SPANISH);
            createChildBlip(blip, translatedText);
         } catch (Exception e) {
            createChildBlip(blip, "Translation failed");

   private void createChildBlip(Blip blip, String s) {
      addTextToBlip(blip.createChild(), s);

   private void addText(Wavelet wavelet, String s) {
      addTextToBlip(wavelet.appendBlip(), s);

   private void addTextToBlip(Blip blip, String s) {
      TextView textView = blip.getDocument();


RSS feed for comments on this post. TrackBack URI

  1. SO does this mean we should call you “Mauricio” from now on? 😉

    • You can call me The Doctor 🙂

  2. Geweldig, kan niet wachten tot ik een invite te pakken krijg!

  3. Any chance of getting an invite?(email in comment header)

    • Sorry, I don’t have any invites (yet). Someone else invited me couple of days ago.

  4. You can call me The Doctor 🙂
    Sorry… forgot to say great post – can’t wait to read your next one!

  5. This new toy won’t stop you releasing 2.6/2.7 compatible GIMP# though, eh? 🙂

  6. Maurits, I just got Google Wave, I have NO experience programming at ALL, but im trying to replicate this…I downloaded the newest version of Eclipse, and after a bit of work, I’ve input everything that you have, while making some changes to names, but it won’t work! It looks like the only problem is in private void addTranslation(Blip blip)
    It’s my first time attempting programming…think you could help me out? I’d really appreciate it. This is so cool.

    • Matt: sure, but I need a little bit more detail before I can help you out. If you want you can send your code to Since you mention that you have no experience programming, I would suggest you also pick up a book on programming see you at least know the basics.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at
Entries and comments feeds.

%d bloggers like this: