Example usage for com.google.gwt.gdata.client.atom Category getTerm

List of usage examples for com.google.gwt.gdata.client.atom Category getTerm

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.atom Category getTerm.

Prototype

public final native String getTerm() ;

Source Link

Document

Returns the term.

Usage

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