List of usage examples for com.google.gwt.gdata.client.atom Text newInstance
public static native Text newInstance() ;
From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerCreateBlogPostCommentDemo.java
License:Apache License
/** * Create a blog comment by inserting a comment entry into * a blog comments feed./*from ww w . j ava2 s. c om*/ * Set the comment's contents to an arbitrary string. Here * we prefix the contents with 'GWT-Blogger-Client' so that * we can identify which comments were created by this demo. * On success and failure, display a status message. * * @param blogId The ID of the blog containing the target post * @param postId The ID of the post to which to reply */ private void insertComment(String blogId, String postId) { showStatus("Creating blog comment entry...", false); CommentEntry comment = CommentEntry.newInstance(); comment.setContent(Text.newInstance()); comment.getContent().setText("GWT-Blogger-Client - Great post!"); String commentsFeedUri = "http://www.blogger.com/feeds/" + blogId + "/" + postId + "/comments/default"; service.insertEntry(commentsFeedUri, comment, new CommentEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while creating the Blogger post " + "comment: " + caught.getMessage(), true); } public void onSuccess(CommentEntry result) { showStatus("Created a comment.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerCreateBlogPostDemo.java
License:Apache License
/** * Create a blog post by inserting a post entry into * a blog posts feed.// ww w. ja va 2 s. c o m * Set the post's title and contents to an arbitrary string. Here * we prefix the title with 'GWT-Blogger-Client' so that * we can identify which posts were created by this demo. * To avoid publishing the new post we set the Atom control status * to "draft". * Finally, we associate the new post with two categories. * On success and failure, display a status message. * * @param postFeed The post feed into which to insert the new post */ private void insertPost(BlogPostFeed postFeed) { showStatus("Creating blog post entry...", false); PostEntry newPost = PostEntry.newInstance(); newPost.setTitle(Text.newInstance()); newPost.getTitle().setText("GWT-Blogger-Client - inserted post"); newPost.setContent(Text.newInstance()); newPost.getContent().setText("This is the body of the blog post. We " + "can include <b>HTML</b> tags."); newPost.setControl(Control.newInstance()); newPost.getControl().setDraft(Draft.newInstance()); newPost.getControl().getDraft().setValue(Draft.VALUE_YES); Category cat1 = Category.newInstance(); cat1.setScheme("http://www.blogger.com/atom/ns#"); cat1.setTerm("Label1"); Category cat2 = Category.newInstance(); cat2.setLabel("http://www.blogger.com/atom/ns#"); cat2.setTerm("Label2"); newPost.setCategories(new Category[] { cat1, cat2 }); postFeed.insertEntry(newPost, new PostEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while creating a blog post: " + caught.getMessage(), true); } public void onSuccess(PostEntry result) { showStatus("Created a blog entry titled '" + result.getTitle().getText() + "'.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerUpdateBlogPostDemo.java
License:Apache License
/** * Update a blog post by making use of the updateEntry * method of the Entry class./*from w w w .jav a2s . c o m*/ * Set the post's title and contents to an arbitrary string. Here * we prefix the title with 'GWT-Blogger-Client' so that * we can identify which posts were updated by this demo. * We also update the name of one of the post's categories. * On success and failure, display a status message. * * @param postEntry The post entry which to update */ private void updatePost(PostEntry postEntry) { showStatus("Updating post entry...", false); postEntry.getTitle().setText("GWT-Blogger-Client - updated post"); postEntry.setContent(Text.newInstance()); postEntry.getContent().setText("My updated post"); Category[] categories = postEntry.getCategories(); for (Category category : categories) { if (category.getTerm().equals("Label1")) { category.setTerm("Label1-updated"); } } postEntry.updateEntry(new PostEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while updating a blog post: " + caught.getMessage(), true); } public void onSuccess(PostEntry result) { showStatus("Updated a blog entry.", false); } }); }
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 . j a v a 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 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.CalendarCreateEventReminderDemo.java
License:Apache License
/** * Create a calendar event by inserting an event entry into * a calendar events feed.//ww w. ja va2 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.//from w ww . j a 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./*from w ww . j a v a 2 s. c om*/ * 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./*w ww . j a v a2 s. c om*/ * 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.CalendarUpdateCalendarDemo.java
License:Apache License
/** * Update a calendar by making use of the updateEntry * method of the Entry class.//from ww w .j av a 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); } }); }
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 ww w. j a va 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 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); } }); }