Example usage for com.google.gwt.gdata.client.gbase SnippetsEntry getTitle

List of usage examples for com.google.gwt.gdata.client.gbase SnippetsEntry getTitle

Introduction

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

Prototype

public final native Text getTitle() ;

Source Link

Document

Returns the title.

Usage

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

License:Apache License

/**
* Displays a set of Google Base snippet entries in a tabular 
* fashion with the help of a GWT FlexTable widget. The data fields 
* Name, Url and Value are displayed./*from  ww  w.j  a  v  a 2s. com*/
* 
* @param entries The Google Base snippet entries to display.
*/
private void showData(SnippetsEntry[] snippets) {
    mainPanel.clear();
    String[] labels = new String[] { "Name", "Url", "Value" };
    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 < snippets.length; i++) {
        SnippetsEntry snippet = snippets[i];
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(snippet.getTitle().getText()));
        mainPanel.addCell(row);
        if (snippet.getHtmlLink() == null) {
            mainPanel.setWidget(row, 1, new Label("Not available"));
        } else {
            String link = snippet.getHtmlLink().getHref();
            mainPanel.setWidget(row, 1,
                    new HTML("<a href=\"" + link + "\" target=\"_blank\">" + link + "</a>"));
        }
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 2, new Label(snippet.getPublished().getValue().getDate().toString()));
    }
}