Example usage for com.google.gwt.gdata.client.blogger CommentEntryCallback CommentEntryCallback

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

Introduction

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

Prototype

CommentEntryCallback

Source Link

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./*  w  w w.  j ava 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);
        }
    });
}

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

License:Apache License

/**
 * Delete a comment entry using the Blogger service and
 * the comment entry uri.//from   w  ww . j ava  2 s . c o  m
 * On success and failure, display a status message.
 * 
 * @param commentEntryUri The uri of the comment entry to delete
 */
private void deleteComment(String commentEntryUri) {
    showStatus("Deleting comment entry...", false);
    service.deleteEntry(commentEntryUri, new CommentEntryCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while deleting a Blogger blog " + "comment: " + caught.getMessage(),
                    true);
        }

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