Example usage for com.google.gwt.gdata.client.blogger PostEntry getCategories

List of usage examples for com.google.gwt.gdata.client.blogger PostEntry getCategories

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.blogger PostEntry getCategories.

Prototype

public final native Category[] getCategories() ;

Source Link

Document

Returns the categories.

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