List of usage examples for com.google.gwt.gdata.client.calendar CalendarEntry getTitle
public final native Text getTitle() ;
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarCreateCalendarDemo.java
License:Apache License
/** * Create a calendar by inserting a calendar entry into * a calendar feed.//w ww. ja v a 2 s . co m * Set the calendar's title to an arbitrary string. Here * we prefix the title with 'GWT-Calendar-Client' so that * we can identify which calendars were created by this demo. * We also specify values for summary, time zone, location * and color. * On success and failure, display a status message. * * @param calendarsFeedUri The uri of the calendars feed into * which to insert the new calendar entry */ private void createCalendar(String calendarsFeedUri) { CalendarEntry entry = CalendarEntry.newInstance(); entry.setTitle(Text.newInstance()); entry.getTitle().setText("GWT-Calendar-Client: insert calendar"); entry.setSummary(Text.newInstance()); entry.getSummary().setText("This is a test calendar created by GWT Client"); entry.setTimeZone(TimeZoneProperty.newInstance()); entry.getTimeZone().setValue("America/Los_Angeles"); Where where = Where.newInstance(); where.setLabel("Mountain View, CA"); where.setValueString("Mountain View, CA"); entry.addLocation(where); entry.setHidden(HiddenProperty.newInstance()); entry.getHidden().setValue(false); entry.setColor(ColorProperty.newInstance()); entry.getColor().setValue(ColorProperty.VALUE_RGB_2952A3); showStatus("Creating calendar...", false); service.insertEntry(calendarsFeedUri, entry, new CalendarEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Calendar feed: " + caught.getMessage(), true); } public void onSuccess(CalendarEntry result) { showStatus("Created a Calendar entry titled '" + result.getTitle().getText() + "'", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarDeleteCalendarDemo.java
License:Apache License
/** * Retrieve the calendars feed using the calendar service and * the calendars feed uri.//from ww w . j a v a 2s . co m * On success, identify the first calendar entry with a title starting * with "GWT-Calendar-Client", this will be the calendar that will be * deleted. * If no calendar is found, display a message. * Otherwise call deleteCalendar to delete the calendar. Alternatively * we could also have used targetCalendar.deleteEntry to * delete the calendar, but the effect is the same. * * @param calendarsFeedUri The uri of the calendars feed */ private void getCalendars(String calendarsFeedUri) { showStatus("Loading calendars...", false); service.getOwnCalendarsFeed(calendarsFeedUri, new CalendarFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Calendar feed: " + caught.getMessage(), true); } public void onSuccess(CalendarFeed result) { CalendarEntry[] entries = result.getEntries(); if (entries.length == 0) { showStatus("You have no calendars.", false); } else { CalendarEntry targetCalendar = null; for (CalendarEntry entry : entries) { String title = entry.getTitle().getText(); if (title.startsWith("GWT-Calendar-Client")) { targetCalendar = entry; break; } } if (targetCalendar == null) { showStatus("Did not find a calendar entry whose title starts " + "with the prefix 'GWT-Calendar-Client'.", false); } else { String calendarEntryUri = targetCalendar.getSelfLink().getHref(); deleteCalendar(calendarEntryUri); } } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarRetrieveCalendarsDemo.java
License:Apache License
/** * Displays a set of Calendar entries in a tabular fashion with * the help of a GWT FlexTable widget. The data fields Title, Color * and Updated are displayed./*from ww w.ja va 2 s .co m*/ * * @param entries The Calendar entries to display. */ private void showData(CalendarEntry[] entries) { mainPanel.clear(); String[] labels = new String[] { "Title", "Color", "Updated" }; mainPanel.insertRow(0); for (int i = 0; i < labels.length; i++) { mainPanel.addCell(0); mainPanel.setWidget(0, i, new Label(labels[i])); mainPanel.getFlexCellFormatter().setStyleName(0, i, "hm-tableheader"); } for (int i = 0; i < entries.length; i++) { CalendarEntry entry = entries[i]; int row = mainPanel.insertRow(i + 1); mainPanel.addCell(row); mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText())); mainPanel.addCell(row); mainPanel.setWidget(row, 1, new Label(entry.getColor().getValue())); mainPanel.addCell(row); mainPanel.setWidget(row, 2, new Label(entry.getUpdated().getValue().getDate().toString())); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarUpdateCalendarDemo.java
License:Apache License
/** * Retrieve the calendars feed using the Calendar service and * the calendars feed uri.//from w ww.j a v a 2s. c o m * On success, identify the first calendar entry with a title * starting with "GWT-Calendar-Client", this will be the calendar * that will be updated. * If no calendar is found, display a message. * Otherwise call updateCalendar to update the calendar. * * @param calendarsFeedUri The uri of the calendars feed */ private void getCalendars(String calendarsFeedUri) { showStatus("Loading calendars...", false); service.getOwnCalendarsFeed(calendarsFeedUri, new CalendarFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Calendar feed: " + caught.getMessage(), true); } public void onSuccess(CalendarFeed result) { CalendarEntry[] entries = result.getEntries(); if (entries.length == 0) { showStatus("You have no calendars.", false); } else { CalendarEntry targetCalendar = null; for (CalendarEntry entry : entries) { String title = entry.getTitle().getText(); if (title.startsWith("GWT-Calendar-Client")) { targetCalendar = entry; break; } } if (targetCalendar == null) { showStatus("Did not find a calendar entry whose title starts " + "with the prefix 'GWT-Calendar-Client'.", false); } else { updateCalendar(targetCalendar); } } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarUpdateCalendarDemo.java
License:Apache License
/** * Update a calendar by making use of the updateEntry * method of the Entry class./* w ww . ja va 2 s . c o m*/ * Set the calendar's title to an arbitrary string. Here * we prefix the title with 'GWT-Calendar-Client' so that * we can identify which calendars were updated by this demo. * On success and failure, display a status message. * * @param targetCalendar The calendar entry which to update */ private void updateCalendar(CalendarEntry targetCalendar) { targetCalendar.setTitle(Text.newInstance()); targetCalendar.getTitle().setText("GWT-Calendar-Client - updated calendar"); showStatus("Updating calendar...", false); targetCalendar.updateEntry(new CalendarEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while updating a calendar: " + caught.getMessage(), true); } public void onSuccess(CalendarEntry result) { showStatus("Updated a calendar.", false); } }); }