Search in sources :

Example 1 with Agreement

use of org.rstudio.studio.client.workbench.model.Agreement in project rstudio by rstudio.

the class Application method verifyAgreement.

private void verifyAgreement(SessionInfo sessionInfo, final Operation verifiedOperation) {
    // get the agreement (if any)
    final Agreement agreement = sessionInfo.pendingAgreement();
    // execute the verifiedOperation immediately)
    if (agreement != null) {
        // append updated to the title if necessary
        String title = agreement.getTitle();
        if (agreement.getUpdated())
            title += " (Updated)";
        view_.showApplicationAgreement(// title and contents   
        title, agreement.getContents(), // bail to sign in page if the user doesn't confirm
        new Operation() {

            public void execute() {
                if (Desktop.isDesktop()) {
                    Desktop.getFrame().setPendingQuit(DesktopFrame.PENDING_QUIT_AND_EXIT);
                    server_.quitSession(false, null, null, GWT.getHostPageBaseURL(), new SimpleRequestCallback<Boolean>());
                } else
                    navigateToSignIn();
            }
        }, // user confirmed
        new Operation() {

            public void execute() {
                // call verified operation
                verifiedOperation.execute();
                // record agreement on server
                server_.acceptAgreement(agreement, new VoidServerRequestCallback());
            }
        });
    } else {
        // no agreement pending
        verifiedOperation.execute();
    }
}
Also used : Agreement(org.rstudio.studio.client.workbench.model.Agreement) Operation(org.rstudio.core.client.widget.Operation) SimpleRequestCallback(org.rstudio.studio.client.common.SimpleRequestCallback)

Aggregations

Operation (org.rstudio.core.client.widget.Operation)1 SimpleRequestCallback (org.rstudio.studio.client.common.SimpleRequestCallback)1 Agreement (org.rstudio.studio.client.workbench.model.Agreement)1