Example usage for com.google.gwt.gdata.client.analytics AccountFeedCallback AccountFeedCallback

List of usage examples for com.google.gwt.gdata.client.analytics AccountFeedCallback AccountFeedCallback

Introduction

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

Prototype

AccountFeedCallback

Source Link

Usage

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

License:Apache License

/**
 * Retrieve the Analytics accounts feed using the Analytics service and
 * the accounts feed uri. In GData all get, insert, update and delete methods
 * always receive a callback defining success and failure handlers.
 * Here, the failure handler displays an error message while the
 * success handler picks up the first Account entry and
 * calls queryData to retrieve the data feed for that account.
 * //from www  .  j  a  va2s  .  c  o m
 * @param accountsFeedUri The uri of the accounts feed
 */
private void getAccounts(String accountsFeedUri) {
    showStatus("Loading Analytics accounts feed...", false);
    service.getAccountFeed(accountsFeedUri, new AccountFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the Analytics " + "Accounts feed: "
                    + caught.getMessage(), true);
        }

        public void onSuccess(AccountFeed result) {
            AccountEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("You have no Analytics accounts.", false);
            } else {
                AccountEntry targetEntry = entries[0];
                queryData(targetEntry.getTableId().getValue());
            }
        }
    });
}

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

License:Apache License

/**
 * Retrieve the Analytics accounts feed using the Analytics service and
 * the accounts feed uri. In GData all get, insert, update and delete methods
 * always receive a callback defining success and failure handlers.
 * Here, the failure handler displays an error message while the
 * success handler calls showData to display all the retrieved
 * Account entries./*  ww  w  .  java2 s . c o m*/
 * 
 * @param accountsFeedUri The uri of the accounts feed
 */
private void getAccounts(String accountsFeedUri) {
    showStatus("Loading Analytics accounts feed...", false);
    service.getAccountFeed(accountsFeedUri, new AccountFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the Analytics " + "Accounts feed: "
                    + caught.getMessage(), true);
        }

        public void onSuccess(AccountFeed result) {
            AccountEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("You have no Analytics accounts.", false);
            } else {
                showData(entries);
            }
        }
    });
}