use of com.vaadin.ui.MenuBar.Command in project Activiti by Activiti.
the class MainMenuBar method initProfileButton.
protected void initProfileButton() {
final LoggedInUser user = ExplorerApp.get().getLoggedInUser();
// User name + link to profile
MenuBar profileMenu = new MenuBar();
profileMenu.addStyleName(ExplorerLayout.STYLE_HEADER_PROFILE_BOX);
MenuItem rootItem = profileMenu.addItem(user.getFirstName() + " " + user.getLastName(), null);
rootItem.setStyleName(ExplorerLayout.STYLE_HEADER_PROFILE_MENU);
if (useProfile()) {
// Show profile
rootItem.addItem(i18nManager.getMessage(Messages.PROFILE_SHOW), new Command() {
public void menuSelected(MenuItem selectedItem) {
ExplorerApp.get().getViewManager().showProfilePopup(user.getId());
}
});
// Edit profile
rootItem.addItem(i18nManager.getMessage(Messages.PROFILE_EDIT), new Command() {
public void menuSelected(MenuItem selectedItem) {
// TODO: Show in edit-mode
ExplorerApp.get().getViewManager().showProfilePopup(user.getId());
}
});
// Change password
rootItem.addItem(i18nManager.getMessage(Messages.PASSWORD_CHANGE), new Command() {
public void menuSelected(MenuItem selectedItem) {
ExplorerApp.get().getViewManager().showPopupWindow(new ChangePasswordPopupWindow());
}
});
rootItem.addSeparator();
}
// Logout
rootItem.addItem(i18nManager.getMessage(Messages.HEADER_LOGOUT), new Command() {
public void menuSelected(MenuItem selectedItem) {
ExplorerApp.get().close();
}
});
addComponent(profileMenu);
setComponentAlignment(profileMenu, Alignment.TOP_RIGHT);
setExpandRatio(profileMenu, 1.0f);
}
Aggregations