Example usage for com.google.gwt.gdata.client.calendar CalendarEventEntry getTitle

List of usage examples for com.google.gwt.gdata.client.calendar CalendarEventEntry getTitle

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.calendar CalendarEventEntry getTitle.

Prototype

public final native Text getTitle() ;

Source Link

Document

Returns the title.

Usage

From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarCreateEventReminderDemo.java

License:Apache License

/**
 * Create a calendar event by inserting an event entry into
 * a calendar events feed./*  ww w  . j ava 2  s . c  o m*/
 * Set the event's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Calendar-Client' so that
 * we can identify which events were created by this demo.
 * We also specify values for time span and reminder settings.
 * On success and failure, display a status message.
 * 
 * @param eventsFeedUri The uri of the events feed into which to 
 * insert the new event
 */
@SuppressWarnings("deprecation")
private void createEvent(String eventsFeedUri) {
    showStatus("Creating event reminder...", false);
    CalendarEventEntry entry = CalendarEventEntry.newInstance();
    entry.setTitle(Text.newInstance());
    entry.getTitle().setText("GWT-Calendar-Client: add event reminder");
    When when = When.newInstance();
    Date startTime = new Date();
    Date endTime = new Date();
    endTime.setHours(endTime.getHours() + 1);
    when.setStartTime(DateTime.newInstance(startTime));
    when.setEndTime(DateTime.newInstance(endTime));
    Reminder reminder = Reminder.newInstance();
    reminder.setMinutes(30);
    reminder.setMethod(Reminder.METHOD_ALERT);
    when.addReminder(reminder);
    entry.addTime(when);
    service.insertEntry(eventsFeedUri, entry, new CalendarEventEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while creating a Calendar event " + "reminder: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(CalendarEventEntry result) {
            showStatus("Created a Calendar event reminder.", false);
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarCreateEventWithExtendedPropertyDemo.java

License:Apache License

/**
 * Create a calendar event by inserting an event entry into
 * a calendar events feed./*w ww .  ja v  a 2s.c o  m*/
 * Set the event's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Calendar-Client' so that
 * we can identify which events were created by this demo.
 * We also specify values for time span and an extended
 * property.
 * On success and failure, display a status message.
 * 
 * @param eventsFeedUri The uri of the events feed into which to 
 * insert the new event
 */
@SuppressWarnings("deprecation")
private void createEvent(String eventsFeedUri) {
    showStatus("Creating event reminder...", false);
    CalendarEventEntry entry = CalendarEventEntry.newInstance();
    entry.setTitle(Text.newInstance());
    entry.getTitle().setText("GWT-Calendar-Client: add extended property");
    When when = When.newInstance();
    Date startTime = new Date();
    Date endTime = new Date();
    endTime.setHours(endTime.getHours() + 1);
    when.setStartTime(DateTime.newInstance(startTime));
    when.setEndTime(DateTime.newInstance(endTime));
    entry.addTime(when);
    CalendarExtendedProperty extendedProp = CalendarExtendedProperty.newInstance();
    extendedProp.setName("mydata");
    extendedProp.setValue("xyz");
    entry.addExtendedProperty(extendedProp);
    service.insertEntry(eventsFeedUri, entry, new CalendarEventEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while creating a Calendar event " + "reminder: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(CalendarEventEntry result) {
            showStatus("Created an event with an extended property.", false);
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarCreateRecurringEventDemo.java

License:Apache License

/**
 * Create a calendar event by inserting an event entry into
 * a calendar events feed./*w  w  w .  jav  a2s  .  c  o m*/
 * Set the event's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Calendar-Client' so that
 * we can identify which events were created by this demo.
 * We also specify the event's recurrence settings.
 * On success and failure, display a status message.
 * 
 * @param eventsFeedUri The uri of the events feed into which to 
 * insert the new event
 */
private void createEvent(String eventsFeedUri) {
    showStatus("Creating event...", false);
    CalendarEventEntry eventEntry = CalendarEventEntry.newInstance();
    eventEntry.setTitle(Text.newInstance());
    eventEntry.getTitle().setText("GWT-Calendar-Client: insert recurring event");
    Recurrence recurrence = Recurrence.newInstance();
    String icalBreak = "\r\n";
    String recurrenceString = "DTSTART;TZID=America/Los_Angeles:20090101T080000" + icalBreak
            + "DTEND;TZID=America/Los_Angeles:20090101T090000" + icalBreak
            + "RRULE:FREQ=WEEKLY;UNTIL=20090701T160000Z;";
    recurrence.setValue(recurrenceString);
    eventEntry.setRecurrence(recurrence);
    service.insertEntry(eventsFeedUri, eventEntry, new CalendarEventEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while creating a Calendar event: " + caught.getMessage(), true);
        }

        public void onSuccess(CalendarEventEntry result) {
            showStatus("Created a recurring event.", false);
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarCreateSingleEventDemo.java

License:Apache License

/**
 * Create a calendar event by inserting an event entry into
 * a calendar events feed./*from w  w  w.j  a  va  2s.c  o m*/
 * Set the event's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Calendar-Client' so that
 * we can identify which events were created by this demo.
 * We also specify values for start and end times.
 * On success and failure, display a status message.
 * 
 * @param eventsFeedUri The uri of the events feed into which to 
 * insert the new event
 */
@SuppressWarnings("deprecation")
private void createEvent(String eventsFeedUri) {
    showStatus("Creating Calendar event...", false);
    CalendarEventEntry eventEntry = CalendarEventEntry.newInstance();
    eventEntry.setTitle(Text.newInstance());
    eventEntry.getTitle().setText("GWT-Calendar-Client: insert event");
    Date startDate = new Date();
    Date endDate = new Date();
    endDate.setHours(endDate.getHours() + 1);
    When when = When.newInstance();
    when.setStartTime(DateTime.newInstance(startDate));
    when.setEndTime(DateTime.newInstance(endDate));
    eventEntry.addTime(when);
    service.insertEntry(eventsFeedUri, eventEntry, new CalendarEventEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while creating a Calendar event: " + caught.getMessage(), true);
        }

        public void onSuccess(CalendarEventEntry result) {
            showStatus("Created a Calendar event taking place in the next hour.", false);
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarQueryEventsByDateDemo.java

License:Apache License

/**
* Displays a set of Calendar event entries in a tabular fashion with
* the help of a GWT FlexTable widget. The data fields Title, URL 
* and Updated are displayed./*from   w  ww .  jav  a2 s. c o  m*/
* 
* @param entries The Calendar event entries to display.
*/
private void showData(CalendarEventEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Title", "URL", "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++) {
        CalendarEventEntry entry = entries[i];
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText()));
        mainPanel.addCell(row);
        String link = entry.getHtmlLink().getHref();
        mainPanel.setWidget(row, 1, new HTML("<a href=\"" + link + "\">" + link + "</a>"));
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 2, new Label(entry.getUpdated().getValue().getDate().toString()));
    }
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarUpdateEventDemo.java

License:Apache License

/**
 * Retrieves a Calendar events feed using a Query object.
 * In GData, feed URIs can contain querystring parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * On success, identify the first event entry with a title starting
 * with "GWT-Calendar-Client", this will be the event that will be updated.
 * If no event is found, display a message.
 * Otherwise call updateEvent to update the event.
 * /*w  ww.j  av a  2 s.c  o  m*/
 * @param eventsFeedUri The uri of the events feed
 */
private void queryEvents(String eventsFeedUri) {
    showStatus("Querying for events...", false);
    CalendarEventQuery query = CalendarEventQuery.newInstance(eventsFeedUri);
    query.setFullTextQuery("GWT-Calendar-Client");
    service.getEventsFeed(query, new CalendarEventFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the Event feed: " + caught.getMessage(), true);
        }

        public void onSuccess(CalendarEventFeed result) {
            CalendarEventEntry[] entries = (CalendarEventEntry[]) result.getEntries();
            if (entries.length == 0) {
                showStatus("No events found containing the text 'GWT-Calendar-Client'.", false);
            } else {
                CalendarEventEntry targetEvent = null;
                for (CalendarEventEntry entry : entries) {
                    String title = entry.getTitle().getText();
                    if (title.startsWith("GWT-Calendar-Client")) {
                        targetEvent = entry;
                        break;
                    }
                }
                if (targetEvent == null) {
                    showStatus("Did not find a event entry whose title starts with "
                            + "the prefix 'GWT-Calendar-Client'.", false);
                } else {
                    updateEvent(targetEvent);
                }
            }
        }
    });
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.CalendarUpdateEventDemo.java

License:Apache License

/**
 * Update an event by making use of the updateEntry
 * method of the Entry class./*from w  w  w. ja  va 2 s .  co m*/
 * Set the event's title to an arbitrary string. Here
 * we prefix the title with 'GWT-Calendar-Client' so that
 * we can identify which events were updated by this demo.
 * On success and failure, display a status message.
 * 
 * @param targetEvent The event entry which to update
 */
private void updateEvent(CalendarEventEntry targetEvent) {
    targetEvent.setTitle(Text.newInstance());
    targetEvent.getTitle().setText("GWT-Calendar-Client - updated event");
    showStatus("Updating a Calendar event...", false);
    targetEvent.updateEntry(new EventEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while updating a Calendar event: " + caught.getMessage(), true);
        }

        public void onSuccess(EventEntry result) {
            showStatus("Updated a Calendar event.", false);
        }
    });
}