Prezi

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in the manual

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Google Wave Gadgets API & GWT

Robots, Gadgets, Embed
by Pamela Fox on 5 May 2010

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Google Wave Gadgets API & GWT

Google Wave
Gadgets API state callback state delta wave.setStateCallback(update);

function update() {
var keys = wave.getState().getKeys();

for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.match('^vote-')) {
total += parseInt(wave.getState().get(key));
count++;
}
}
document.getElementById('total').innerHTML = total;
} function onClick() {
wave.getState().submitValue('vote-' wave.getViewer().getId(), -1);
}
State Delta State Callback XML CSS HTML JS CSS HTML XML Gadgets API Wave Gadgets API + Wave Gadget = Mini Webpage Shared State Collaborative Web App + = state: vote-douwe@google.com | 1 state: import org.cobogw.gwt.waveapi.gadget.client.StateUpdateEvent;
import org.cobogw.gwt.waveapi.gadget.client.StateUpdateEventHandler;
import org.cobogw.gwt.waveapi.gadget.client.WaveGadget;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.gadgets.client.Gadget;
import com.google.gwt.gadgets.client.UserPreferences;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;

@Gadget.ModulePrefs(title = "PlusOne")
public class SimpleCounter extends WaveGadget<UserPreferences> {

private final Label counterLabel = new Label();

private final Button incrementButton = new Button("+1");

private final Button decrementButton = new Button("-1");

@Override
protected void init() {


// Event handlers for increment and decrement buttons
// First they update the local counter's value to the new value
// and then they store the new value in wave's shared state
incrementButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
String viewer = getWave().getViewer().getId();
getWave().getState().submitValue(viewer, '1');
}
});
decrementButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
String viewer = getWave().getViewer().getId();
getWave().getState().submitValue(viewer, '1');
}
});

// Adding the ui elements to the root panel
RootPanel.get().add(counterLabel);
RootPanel.get().add(incrementButton);
RootPanel.get().add(decrementButton);

getWave().addStateUpdateEventHandler(new StateUpdateEventHandler() {
public void onUpdate(StateUpdateEvent event) {
int total = 0;
JsArrayString keys = getWave().getState().getKeys();
for (int i = 0; i < keys.length(); i++) {
String key = keys.get(i);
String value = getWave().get(key);
total += (int) value;
}
counterLabel.setText(total);
}
});
}
} GWT
See the full transcript