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

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

Introduction

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

Prototype

public static native CommentEntry newInstance() ;

Source Link

Document

Constructs a comment entry.

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