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

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

Introduction

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

Prototype

public final native Text getTitle() ;

Source Link

Document

Returns the title.

Usage

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

License:Apache License

/**
 * Retrieve the Blogger comments feed using the Blogger service and
 * the comments feed uri for a given post.
 * On success, identify the first comment entry with a title starting
 * with "GWT-Blogger-Client", this will be the comment that will be deleted.
 * If no comment is found, display a message.
 * Otherwise call deleteComment to delete the comment. Alternatively
 * we could also have used targetComment.deleteEntry to
 * delete the comment, but the effect is the same.
 * /*w  w w  .j  av  a2 s  . c  o  m*/
 * @param commentsFeedUri The comments feed uri for a given post
 */
private void getComments(String commentsFeedUri) {
    showStatus("Loading Blogger post comments feed...", false);
    service.getBlogCommentFeed(commentsFeedUri, new BlogCommentFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus(
                    "An error occurred while retrieving the Blogger Comments " + "feed: " + caught.getMessage(),
                    true);
        }

        public void onSuccess(BlogCommentFeed result) {
            if (result.getEntries().length == 0) {
                showStatus("The target blog post has no comments.", false);
            } else {
                // get the first comment that matches
                CommentEntry targetComment = null;
                for (CommentEntry comment : result.getEntries()) {
                    String title = comment.getTitle().getText();
                    if (title.startsWith("GWT-Blogger-Client")) {
                        targetComment = comment;
                        break;
                    }
                }
                if (targetComment == null) {
                    showStatus("Did not find a comment entry whose title starts "
                            + "with the prefix 'GWT-Blogger-Client'.", false);
                } else {
                    deleteComment(targetComment.getSelfLink().getHref());
                }
            }
        }
    });
}

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

License:Apache License

/**
* Displays a set of Blogger comment entries in a tabular fashion with
* the help of a GWT FlexTable widget. The data fields Title, URL 
* and Published are displayed.// www.  j  a  v a  2s.com
* 
* @param entries The Blogger comment entries to display.
*/
private void showData(CommentEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Title", "URL", "Published" };
    mainPanel.insertRow(0);
    for (int i = 0; i < labels.length; i++) {
        mainPanel.addCell(0);
        mainPanel.setWidget(0, i, new Label(labels[i]));
        mainPanel.getFlexCellFormatter().setStyleName(0, i, "hm-tableheader");
    }
    for (int i = 0; i < entries.length; i++) {
        CommentEntry entry = entries[i];
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText()));
        mainPanel.addCell(row);
        if (entry.getHtmlLink() == null) {
            mainPanel.setWidget(row, 1, new Label("Not available"));
        } else {
            String link = entry.getHtmlLink().getHref();
            mainPanel.setWidget(row, 1,
                    new HTML("<a href=\"" + link + "\" target=\"_blank\">" + link + "</a>"));
        }
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 2, new Label(entry.getPublished().getValue().getDate().toString()));
    }
}