Example usage for com.google.gwt.gdata.client.maps FeatureEntry setTitle

List of usage examples for com.google.gwt.gdata.client.maps FeatureEntry setTitle

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.maps FeatureEntry setTitle.

Prototype

public final native void setTitle(Text title) ;

Source Link

Document

Sets the title.

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.//w ww. j a v a  2s . 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);
        }
    });
}

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

License:Apache License

/**
 * Update a map feature by making use of the updateEntry
 * method of the Entry class.//from  w w w  . ja  v  a2s  . co  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 updated by this demo.
 * On success and failure, display a status message.
 * 
 * @param targetFeature The feature entry which to update
 */
private void updateFeature(FeatureEntry targetFeature) {
    showStatus("Updating map feature...", false);
    targetFeature.setTitle(Text.newInstance());
    targetFeature.getTitle().setText("GWT-Maps-Client - updated feature");
    targetFeature.updateEntry(new FeatureEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while updating a map feature: " + caught.getMessage(), true);
        }

        public void onSuccess(FeatureEntry result) {
            showStatus("Updated a map feature.", false);
        }
    });
}