}
/** Insert a new event for the given calendar ID. */
private void insertEvent(final String calendarId) {
String today = DateTimeFormat.getFormat("yyyy-MM-dd").format(new Date());
EventsContext ctx = calendar.events();
Event event = ctx.create(Event.class)
.setSummary("Learn about the Google API GWT client library")
.setStart(ctx.create(EventDateTime.class).setDateTime(today))
.setEnd(ctx.create(EventDateTime.class).setDateTime(today));
// Note that the EventsContext used to insert the Event has to be the same one used to create
// it.
ctx.insert(calendarId, event).fire(new Receiver<Event>() {
@Override
public void onSuccess(Event inserted) {
// The event has been inserted.
// Now we'll demonstrate retrieving it and updating it.