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());
}
Aggregations