Search in sources :

Example 1 with LogoutWidget

use of cz.metacentrum.perun.webgui.widgets.LogoutWidget in project perun by CESNET.

the class ApplicationFormLeftMenu method addLogoutItem.

public void addLogoutItem() {
    // if not anonymous identity
    if (!PerunWebSession.getInstance().getRpcUrl().startsWith("/non/rpc")) {
        int i = menuContents.getRowCount();
        menuContents.setWidget(i, 0, new Image(SmallIcons.INSTANCE.doorOutIcon()));
        Anchor a = new Anchor(ApplicationMessages.INSTANCE.logout());
        a.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                Logout call = new Logout(new JsonCallbackEvents() {

                    @Override
                    public void onFinished(JavaScriptObject jso) {
                        Utils.clearFederationCookies();
                        History.newItem("logout");
                        RootLayoutPanel.get().clear();
                        RootLayoutPanel.get().add(new LogoutWidget());
                    }
                });
                call.retrieveData();
            }
        });
        menuContents.setWidget(i, 1, a);
    }
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Logout(cz.metacentrum.perun.webgui.json.authzResolver.Logout) LogoutWidget(cz.metacentrum.perun.webgui.widgets.LogoutWidget)

Aggregations

JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)1 Logout (cz.metacentrum.perun.webgui.json.authzResolver.Logout)1 LogoutWidget (cz.metacentrum.perun.webgui.widgets.LogoutWidget)1