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.ContactsCreateContactDemo.java
License:Apache License
/** * Create a contact by inserting a contact entry into * a contacts feed.// www . j av a 2s .c om * Set the contact's title and contents to an arbitrary string. Here * we prefix the title with 'GWT-Contacts-Client' so that * we can identify which contacts were created by this demo. * On success and failure, display a status message. * * @param contactFeedUri The uri of the contact feed into which to * insert the new contact entry */ private void createContact(String contactFeedUri) { showStatus("Creating contact...", false); ContactEntry entry = ContactEntry.newInstance(); entry.setTitle(Text.newInstance()); entry.getTitle().setText("GWT-Contacts-Client - Create Contact"); entry.setContent(Text.newInstance()); entry.getContent().setText("content info here"); Email email = Email.newInstance(); email.setAddress("GWT-Contacts-Client@domain.com"); email.setPrimary(true); email.setRel(Email.REL_HOME); entry.setEmailAddresses(new Email[] { email }); service.insertEntry(contactFeedUri, entry, new ContactEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while creating a contact: " + caught.getMessage(), true); } public void onSuccess(ContactEntry result) { showStatus("Created a contact.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.ContactsCreateContactGroupDemo.java
License:Apache License
/** * Create a contact group by inserting a contact group entry into * a contact groups feed./*from ww w. ja v a2 s . com*/ * Set the contact group's title to an arbitrary string. Here * we prefix the title with 'GWT-Contacts-Client' so that * we can identify which groups were created by this demo. * On success and failure, display a status message. * * @param contactGroupFeedUri The uri of the groups feed into which * to insert the new group entry */ private void createContactGroup(String contactGroupFeedUri) { showStatus("Creating contact group...", false); ContactGroupEntry entry = ContactGroupEntry.newInstance(); entry.setTitle(Text.newInstance()); entry.getTitle().setText("GWT-Contacts-Client - Create Group"); service.insertEntry(contactGroupFeedUri, entry, new ContactGroupEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while creating a contact group: " + caught.getMessage(), true); } public void onSuccess(ContactGroupEntry result) { showStatus("Created a contact group.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.ContactsUpdateContactDemo.java
License:Apache License
/** * Update a contact by making use of the updateEntry * method of the Entry class./* ww w .j a v a 2 s . co m*/ * Set the contact's title to an arbitrary string. Here * we prefix the title with 'GWT-Contacts-Client' so that * we can identify which contacts were updated by this demo. * We also update the contact's phone number. * On success and failure, display a status message. * * @param targetContact The contact entry which to update */ private void updateContact(ContactEntry targetContact) { targetContact.setTitle(Text.newInstance()); targetContact.getTitle().setText("GWT-Contacts-Client - updated contact"); PhoneNumber phoneNumber = PhoneNumber.newInstance(); phoneNumber.setValue("123-456-7890"); phoneNumber.setRel(PhoneNumber.REL_WORK); targetContact.setPhoneNumbers(new PhoneNumber[] { phoneNumber }); showStatus("Updating a contact event...", false); targetContact.updateEntry(new PersonEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while updating a contact: " + caught.getMessage(), true); } public void onSuccess(PersonEntry result) { showStatus("Updated a contact.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.ContactsUpdateContactGroupDemo.java
License:Apache License
/** * Update a contact group by making use of the updateEntry * method of the Entry class./* w ww . jav a 2s . co m*/ * Set the group's title to an arbitrary string. Here * we prefix the title with 'GWT-Contacts-Client' so that * we can identify which groups were updated by this demo. * On success and failure, display a status message. * * @param targetGroup The contact group entry which to update */ private void updateContactGroup(ContactGroupEntry targetGroup) { showStatus("Updating a contact group...", false); targetGroup.setTitle(Text.newInstance()); targetGroup.getTitle().setText("GWT-Contacts-Client - updated group"); targetGroup.updateEntry(new ContactGroupEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while updating a contact group: " + caught.getMessage(), true); } public void onSuccess(ContactGroupEntry result) { showStatus("Updated a contact group.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.FinanceCreatePortfolioDemo.java
License:Apache License
/** * Create a portfolio by inserting a portfolio entry into * a portfolio feed.//from w w w . j a v a 2s . com * Set the portfolio's title to an arbitrary string. Here * we prefix the title with 'GWT-Finance-Client' so that * we can identify which portfolios were created by this demo. * The new portfolio is created with currency code set to USD. * On success and failure, display a status message. * * @param portfolioFeedUri The uri of the portfolio feed into which * to insert the portfolio entry */ private void createPortfolio(String portfolioFeedUri) { showStatus("Creating portfolio...", false); PortfolioEntry entry = PortfolioEntry.newInstance(); entry.setTitle(Text.newInstance()); entry.getTitle().setText("GWT-Finance-Client - inserted portfolio"); PortfolioData data = PortfolioData.newInstance(); data.setCurrencyCode("USD"); entry.setPortfolioData(data); service.insertEntry(portfolioFeedUri, entry, new PortfolioEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while creating a portfolio: " + caught.getMessage(), true); } public void onSuccess(PortfolioEntry result) { showStatus("Created a portfolio.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.FinanceUpdatePortfolioDemo.java
License:Apache License
/** * Update a portfolio by making use of the updateEntry * method of the Entry class.// www . j a v a2 s . c o m * Set the portfolio title to an arbitrary string. Here * we prefix the title with 'GWT-Finance-Client' so that * we can identify which portfolios were updated by this demo. * On success and failure, display a status message. * * @param targetPortfolio The portfolio entry which to update */ private void updatePortfolio(PortfolioEntry targetPortfolio) { showStatus("Updating portfolio...", false); targetPortfolio.setTitle(Text.newInstance()); targetPortfolio.getTitle().setText("GWT-Finance-Client - updated portfolio"); targetPortfolio.updateEntry(new PortfolioEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while updating a portfolio: " + caught.getMessage(), true); } public void onSuccess(PortfolioEntry result) { showStatus("Updated a portfolio.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.GoogleBaseCreateItemDemo.java
License:Apache License
/** * Create an item by inserting an item entry into * an items feed./*from w w w . jav a 2 s.co m*/ * Set the item's title to an arbitrary string. Here * we prefix the title with 'GWT-GoogleBase-Client' so that * we can identify which items were created by this demo. * The new item is created as a product review with values * for the default product review attributes. * On success and failure, display a status message. * * @param itemsFeedUri The uri of the items feed into which * to insert the new item entry */ private void createItem(String itemsFeedUri) { showStatus("Creating item...", false); ItemsEntry entry = ItemsEntry.newInstance(); entry.setTitle(Text.newInstance()); entry.getTitle().setText("GWT-GoogleBase-Client - inserted item"); entry.setContent(Text.newInstance()); entry.getContent().setText("GData is great data!! :)"); Attribute targetCountry = Attribute.newInstance(); targetCountry.setValue("US"); Attribute reviewType = Attribute.newInstance(); reviewType.setValue("Product Review"); Attribute nameOfItem = Attribute.newInstance(); nameOfItem.setValue("gwt-gdata"); Attribute expirationDate = Attribute.newInstance(); expirationDate.setValue("2038-01-19T03:14:07Z"); Attribute rating = Attribute.newInstance(); rating.setValue("5-Excellent"); Attribute customerId = Attribute.newInstance(); customerId.setValue("5752122"); Attribute itemType = Attribute.newInstance(); itemType.setValue("Reviews"); Attribute itemLanguage = Attribute.newInstance(); itemLanguage.setValue("en"); entry.setAttribute("target_country", targetCountry); entry.setAttribute("review_type", reviewType); entry.setAttribute("name_of_item_reviewed", nameOfItem); entry.setAttribute("expiration_date", expirationDate); entry.setAttribute("rating", rating); entry.setAttribute("customer_id", customerId); entry.setAttribute("item_type", itemType); entry.setAttribute("item_language", itemLanguage); service.insertEntry(itemsFeedUri, entry, new ItemsEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while creating an item: " + caught.getMessage(), true); } public void onSuccess(ItemsEntry result) { showStatus("Created an item.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.GoogleBaseUpdateItemDemo.java
License:Apache License
/** * Update an item by making use of the updateEntry * method of the Entry class./*from w w w . j ava 2 s .c om*/ * Set the item's title to an arbitrary string. Here * we prefix the title with 'GWT-GoogleBase-Client' so that * we can identify which items were updated by this demo. * We also update the target_country property for this item. * On success and failure, display a status message. * * @param itemsEntry The item entry which to update */ private void updateItem(ItemsEntry itemsEntry) { showStatus("Updating item...", false); itemsEntry.setTitle(Text.newInstance()); itemsEntry.getTitle().setText("GWT-GoogleBase-Client - updated item"); MapAttribute attributes = itemsEntry.getAttributes(); if (attributes.contains("target_country")) { attributes.get("target_country")[0].setValue("UK"); } itemsEntry.updateEntry(new ItemsEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while updating an item: " + caught.getMessage(), true); } public void onSuccess(ItemsEntry result) { showStatus("Updated an item.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsCreateMapDemo.java
License:Apache License
/** * Create a map by inserting a map entry into * a maps feed./*from w w w. ja v a2 s . c om*/ * Set the map's title and contents to an arbitrary string. Here * we prefix the title with 'GWT-Maps-Client' so that * we can identify which maps were created by this demo. * On success and failure, display a status message. * * @param mapsFeedUri The uri of the maps feed into which to * insert the new map entry */ private void createMap(String mapsFeedUri) { showStatus("Creating map...", false); MapEntry entry = MapEntry.newInstance(); entry.setTitle(Text.newInstance()); entry.getTitle().setText("GWT-Maps-Client - inserted map"); service.insertEntry(mapsFeedUri, entry, new MapEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while creating a map: " + caught.getMessage(), true); } public void onSuccess(MapEntry result) { showStatus("Created a map.", false); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.MapsCreateMapFeatureDemo.java
License:Apache License
/** * Create a feature by inserting a feature entry into * a feature feed for a given map./*from w ww.j av a 2 s . c om*/ * Set the feature's title to an arbitrary string. Here * we prefix the title with 'GWT-Maps-Client' so that * we can identify which features were created by this demo. * A value is also provided for the feature's postal address * along with the KML content which defines the placemarks * for this feature. * On success and failure, display a status message. * * @param mapId The id of the map into which to insert the * new feature entry */ private void insertMapFeature(String mapId) { showStatus("Creating map feature...", false); FeatureEntry entry = FeatureEntry.newInstance(); entry.setTitle(Text.newInstance()); entry.getTitle().setText("GWT-Maps-Client - inserted feature"); PostalAddress address = PostalAddress.newInstance(); address.setLabel("Google Headquarters"); address.setRel(PostalAddress.REL_WORK); address.setValue("1600 Amphitheatre Parkway\nMountain View, CA 94043"); entry.setPostalAddress(address); KmlContent kml = KmlContent.newInstance(); kml.setType(KmlContent.TYPE_APPLICATION_VND_GOOGLE_EARTH_KML_XML); kml.setText("<Placemark xmlns=\"http://www.opengis.net/kml/2.2\">" + "<name>Faulkner's Birthplace</name>" + "<description/><Point><coordinates>-89.520753,34.360902,0.0" + "</coordinates></Point><" + "/Placemark>"); entry.setContent(kml); String featuresFeedUri = mapId.replace("/feeds/maps/", "/feeds/features/") + "/full"; service.insertEntry(featuresFeedUri, entry, new FeatureEntryCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while creating a map feature: " + caught.getMessage(), true); } public void onSuccess(FeatureEntry result) { showStatus("Created a map feature.", false); } }); }