Search in sources :

Example 1 with LogoutRequestedEvent

use of org.rstudio.studio.client.application.events.LogoutRequestedEvent in project rstudio by rstudio.

the class WebApplicationHeader method initCommandsPanel.

private void initCommandsPanel(final SessionInfo sessionInfo) {
    // add username 
    if (sessionInfo.getShowIdentity()) {
        ToolbarLabel usernameLabel = new ToolbarLabel();
        usernameLabel.getElement().getStyle().setMarginRight(2, Unit.PX);
        if (!BrowseCap.isFirefox())
            usernameLabel.getElement().getStyle().setMarginTop(2, Unit.PX);
        String userIdentity = sessionInfo.getUserIdentity();
        usernameLabel.setTitle(userIdentity);
        userIdentity = userIdentity.split("@")[0];
        usernameLabel.setText(userIdentity);
        headerBarCommandsPanel_.add(usernameLabel);
        ToolbarButton signOutButton = new ToolbarButton(new ImageResource2x(RESOURCES.signOut2x()), new ClickHandler() {

            public void onClick(ClickEvent event) {
                eventBus_.fireEvent(new LogoutRequestedEvent());
            }
        });
        signOutButton.setTitle("Sign out");
        headerBarCommandsPanel_.add(signOutButton);
        headerBarCommandsPanel_.add(signOutSeparator_ = createCommandSeparator());
    }
    overlay_.addCommands(this);
    headerBarCommandsPanel_.add(commands_.quitSession().createToolbarButton());
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) LogoutRequestedEvent(org.rstudio.studio.client.application.events.LogoutRequestedEvent) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ToolbarLabel(org.rstudio.core.client.widget.ToolbarLabel) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Aggregations

ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)1 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)1 ToolbarLabel (org.rstudio.core.client.widget.ToolbarLabel)1 LogoutRequestedEvent (org.rstudio.studio.client.application.events.LogoutRequestedEvent)1