Example usage for com.google.gwt.accounts.client User getStatus

List of usage examples for com.google.gwt.accounts.client User getStatus

Introduction

In this page you can find the example usage for com.google.gwt.accounts.client User getStatus.

Prototype

public static final native AuthSubStatus getStatus() ;

Source Link

Document

Returns the current status of the AuthSubJS process.

Usage

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

License:Apache License

/**
 * Invoked when GData has loaded. Build the UI and display the default demo.
 *///from   w w w .j  av a2  s  . co m
public void onGDataLoad() {
    if (User.getStatus() == AuthSubStatus.LOGGING_IN) {
        /*
         * AuthSub causes a refresh of the browser, so if status is LOGGING_IN
         * don't render anything. An empty page refresh is friendlier.
         */
        return;
    }

    DecoratorPanel decorator = new DecoratorPanel();
    decorator.add(outerPanel);

    RootPanel.get().setStylePrimaryName("hm-body");
    RootPanel.get().add(new HTML("<img src='logo-small.png' alt='gwt logo' "
            + "align='absmiddle'><span class='hm-title'>Google GData API Library " + "for GWT Demo</span>"));
    RootPanel.get().add(decorator);

    innerPanel.setStylePrimaryName("hm-innerpanel");
    innerPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    innerPanel.setSpacing(10);

    outerPanel.setStylePrimaryName("hm-outerpanel");
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);

    outerPanel.addCell(0);
    outerPanel.addCell(1);
    outerPanel.addCell(2);
    outerPanel.addCell(3);

    outerPanel.setWidget(0, 0,
            new HTML("This GData-enabled application was built using the GData " + "API Library for GWT, "
                    + "<a href=\"http://code.google.com/p/gwt-gdata/\">"
                    + "http://code.google.com/p/gwt-gdata/</a>. "
                    + "The drop down list below allows you to select a scenario that "
                    + "demonstrates a particular capability of the GData support."));

    outerPanel.setWidget(1, 0, innerPanel);

    HorizontalPanel horizPanel = new HorizontalPanel();
    list.setStylePrimaryName("hm-demolistbox");
    list.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            GDataDemoInfo info = list.getGDataDemoSelection();
            if (info == null) {
                showInfo();
            } else {
                show(info);
            }
        }
    });
    description.setStylePrimaryName("hm-description");
    innerPanel.clear();
    innerPanel.add(horizPanel);
    innerPanel.add(description);
    horizPanel.add(new Label("Select Demo: "));
    horizPanel.add(list);
    loadGDataDemos();
    showInfo();
}