List of usage examples for com.google.gwt.accounts.client User getStatus
public static final native AuthSubStatus getStatus(String scope) ;
From source file:com.google.gwt.gdata.sample.hellogdata.client.AccountsAuthSubAuthenticationDemo.java
License:Apache License
/** * Display the AuthSub authentication statuses in a * tabular fashion with the help of a GWT FlexTable widget. * We initialize an array containing the name, scope, icon * and url for each of the supported GData systems. * For each system a table row is added displaying the name, * page, link and icon, in addition to the AuthSub status * and a hyperlink for logging in or logging, as appropriate. * The User class contains the getStatus method which is used * to retrieve the authentication status for the current user * and for a given system (scope)./* w ww. ja va 2s.c o m*/ */ private void showAuthSubStatus() { String[][] systems = new String[][] { new String[] { "Google Analytics", "https://www.google.com/analytics/feeds/", "gdata-analytics.png", "http://code.google.com/apis/analytics/" }, new String[] { "Google Base", "http://www.google.com/base/feeds/", "gdata-base.png", "http://code.google.com/apis/base/" }, new String[] { "Google Blogger", "http://www.blogger.com/feeds/", "gdata-blogger.png", "http://code.google.com/apis/blogger/" }, new String[] { "Google Calendar", "http://www.google.com/calendar/feeds/", "gdata-calendar.png", "http://code.google.com/apis/calendar/" }, new String[] { "Google Contacts", "http://www.google.com/m8/feeds/", "gdata-contacts.png", "http://code.google.com/apis/contacts/" }, new String[] { "Google Finance", "http://finance.google.com/finance/feeds/", "gdata-finance.png", "http://code.google.com/apis/finance/" }, new String[] { "Google Maps", "http://maps.google.com/maps/feeds/", "gdata-maps.png", "http://code.google.com/apis/maps/documentation/mapsdata/" }, new String[] { "Google Sidewiki", "http://www.google.com/sidewiki/feeds/", "gdata-sidewiki.png", "http://code.google.com/apis/sidewiki/" } }; for (int i = 0; i < systems.length; i++) { String[] sys = systems[i]; final String scope = sys[1]; mainPanel.insertRow(i); mainPanel.addCell(i); mainPanel.addCell(i); mainPanel.addCell(i); mainPanel.addCell(i); Image icon = new Image(sys[2]); mainPanel.setWidget(i, 0, icon); Label name = new HTML("<a href=\"" + sys[3] + "\">" + sys[0] + "</a>"); mainPanel.setWidget(i, 1, name); Label statusLabel = new Label(); Anchor actionLink = new Anchor(); AuthSubStatus status = User.getStatus(scope); if (status == AuthSubStatus.LOGGED_IN) { statusLabel.setText("Logged in"); actionLink.setText("Log out"); actionLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { User.logout(scope); refreshDemo(); } }); } else if (status == AuthSubStatus.LOGGED_OUT) { statusLabel.setText("Logged out"); actionLink.setText("Log in"); actionLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { User.login(scope); } }); } mainPanel.setWidget(i, 2, statusLabel); mainPanel.setWidget(i, 3, actionLink); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsBounceRateDemo.java
License:Apache License
/** * Starts this demo./*from w w w . ja v a2 s . c om*/ */ private void startDemo() { service = AnalyticsService.newInstance("HelloGData_Analytics_BounceRateDemo_v2.0"); if (User.getStatus(scope) == AuthSubStatus.LOGGED_IN) { getAccounts("https://www.google.com/analytics/feeds/accounts/default"); } else { showStatus("You are not logged on to Google Analytics.", true); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsLanguagesDemo.java
License:Apache License
/** * Starts this demo.//ww w.jav a2 s. c o m */ private void startDemo() { service = AnalyticsService.newInstance("HelloGData_Analytics_LanguagesDemo_v2.0"); if (User.getStatus(scope) == AuthSubStatus.LOGGED_IN) { getAccounts("https://www.google.com/analytics/feeds/accounts/" + "default?max-results=50"); } else { showStatus("You are not logged on to Google Analytics.", true); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsTopPagesDemo.java
License:Apache License
/** * Starts this demo.//w w w . j a v a 2 s . c om */ private void startDemo() { service = AnalyticsService.newInstance("HelloGData_Analytics_TopPagesDemo_v2.0"); if (User.getStatus(scope) == AuthSubStatus.LOGGED_IN) { getAccounts("https://www.google.com/analytics/feeds/accounts/" + "default?max-results=50"); } else { showStatus("You are not logged on to Google Analytics.", true); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsTopSearchesDemo.java
License:Apache License
/** * Starts this demo.//from w ww . jav a 2 s .c om */ private void startDemo() { service = AnalyticsService.newInstance("HelloGData_Analytics_TopSearchesDemo_v2.0"); if (User.getStatus(scope) == AuthSubStatus.LOGGED_IN) { getAccounts("https://www.google.com/analytics/feeds/accounts/" + "default?max-results=50"); } else { showStatus("You are not logged on to Google Analytics.", true); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsVisitsDemo.java
License:Apache License
/** * Starts this demo.// ww w. j av a 2s.c om */ private void startDemo() { service = AnalyticsService.newInstance("HelloGData_Analytics_VisitsDemo_v2.0"); if (User.getStatus(scope) == AuthSubStatus.LOGGED_IN) { getAccounts("https://www.google.com/analytics/feeds/accounts/" + "default?max-results=50"); } else { showStatus("You are not logged on to Google Analytics.", true); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsYourAccountsDemo.java
License:Apache License
/** * Starts this demo./*ww w . j a v a 2 s . c o m*/ */ private void startDemo() { service = AnalyticsService.newInstance("HelloGData_Analytics_YourAccountsDemo_v2.0"); if (User.getStatus(scope) == AuthSubStatus.LOGGED_IN) { getAccounts("https://www.google.com/analytics/feeds/accounts/" + "default?max-results=50"); } else { showStatus("You are not logged on to Google Analytics.", true); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerCreateBlogPostCommentDemo.java
License:Apache License
/** * Starts this demo.// w w w. j a v a2 s. co m */ private void startDemo() { service = BloggerService.newInstance("HelloGData_Blogger_CreateBlogPostCommentDemo_v2.0"); if (User.getStatus(scope) == AuthSubStatus.LOGGED_IN) { Button startButton = new Button("Create a blog comment"); startButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { getBlogs("http://www.blogger.com/feeds/default/blogs"); } }); mainPanel.setWidget(0, 0, startButton); } else { showStatus("You are not logged on to Blogger.", true); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerCreateBlogPostDemo.java
License:Apache License
/** * Starts this demo./* www . j a va2 s. co m*/ */ private void startDemo() { service = BloggerService.newInstance("HelloGData_Blogger_CreateBlogPostDemo_v2.0"); if (User.getStatus(scope) == AuthSubStatus.LOGGED_IN) { Button startButton = new Button("Create a blog post"); startButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { getBlogs("http://www.blogger.com/feeds/default/blogs"); } }); mainPanel.setWidget(0, 0, startButton); } else { showStatus("You are not logged on to Blogger.", true); } }
From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerDeleteBlogPostCommentDemo.java
License:Apache License
/** * Starts this demo.//from w w w . j ava 2s . c o m */ private void startDemo() { service = BloggerService.newInstance("HelloGData_Blogger_DeleteBlogPostCommentDemo_v2.0"); if (User.getStatus(scope) == AuthSubStatus.LOGGED_IN) { Button startButton = new Button("Delete a blog comment"); startButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { getBlogs("http://www.blogger.com/feeds/default/blogs"); } }); mainPanel.setWidget(0, 0, startButton); } else { showStatus("You are not logged on to Blogger.", true); } }