Example usage for com.google.gwt.gdata.client PostalAddress REL_WORK

List of usage examples for com.google.gwt.gdata.client PostalAddress REL_WORK

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client PostalAddress REL_WORK.

Prototype

String REL_WORK

To view the source code for com.google.gwt.gdata.client PostalAddress REL_WORK.

Click Source Link

Document

Work address.

Usage

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.//ww  w .j  av a2 s .  c o m
 * 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);
        }
    });
}