With the new Robot API version 2 is it possible to interact with the gadgets using robots. This will allow for some interesting integrations and will mean that the gadgets can be used to show the graphical information that needs to be displayed by a user. By using the robot to fetch and populate the data, you are also able to make the requests update other information than is possible using the social API.
I have created a small demo that shows how this can work out. Look at this video.
The code for the robot is the following.
protected String getRobotName() {
return "DGR1";
}
@Override
public void onWaveletSelfAdded(WaveletSelfAddedEvent event) {
Blip blip = event.getWavelet().reply("\nHi everybody!");
blip.append(new Gadget("http://dgrjava1.appspot.com/gadget.xml"));
}
@Override
public void onGadgetStateChanged(GadgetStateChangedEvent event) {
Blip blip = event.getBlip();
Gadget gadget = (Gadget) blip.getElements().get(event.getIndex());
String count = gadget.getProperty("count");
blip.append("State changed changed " + count);
gadget.setProperty("count", "56");
}
Currently it is not possible with the Java api to update the gadget. But there is room for it in the gadget state information.
Related posts:
- Gadget and Robots interaction In some instances you want to have the robots...
- Add-Robot A robot which can stores user favorite robots using...
- New Google Wave Robot API v2 Finally there is an update to the Google Wave...
- At-Buddy When I was just starting to learn Google Wave...
- New Robot API Just found that a new JAVA API of the...
Related posts brought to you by Yet Another Related Posts Plugin.
1 comment so far ↓
AFAIK you can currently only update a gadget with an ugly workaround:
Remove the gadget and add it again. This will cause some flickering in the client but ensures having a gadget with the new state shown in the wave.
HTH,
Martin
Leave a Comment