Example usage for com.google.gwt.gdata.client.blogger CommentEntry setContent

List of usage examples for com.google.gwt.gdata.client.blogger CommentEntry setContent

Introduction

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

Prototype

public final native void setContent(Text content) ;

Source Link

Document

Sets the content.

Usage

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

License:Apache License

/**
 * Create a blog comment by inserting a comment entry into
 * a blog comments feed./*from   w  w w .j a va 2  s .c  o m*/
 * Set the comment's contents to an arbitrary string. Here
 * we prefix the contents with 'GWT-Blogger-Client' so that
 * we can identify which comments were created by this demo.
 * On success and failure, display a status message.
 * 
 * @param blogId The ID of the blog containing the target post
 * @param postId The ID of the post to which to reply
 */
private void insertComment(String blogId, String postId) {
    showStatus("Creating blog comment entry...", false);
    CommentEntry comment = CommentEntry.newInstance();
    comment.setContent(Text.newInstance());
    comment.getContent().setText("GWT-Blogger-Client - Great post!");
    String commentsFeedUri = "http://www.blogger.com/feeds/" + blogId + "/" + postId + "/comments/default";
    service.insertEntry(commentsFeedUri, comment, new CommentEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while creating the Blogger post " + "comment: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(CommentEntry result) {
            showStatus("Created a comment.", false);
        }
    });
}