Search in sources :

Example 1 with Command

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);
}
Also used : ChangePasswordPopupWindow(org.activiti.explorer.ui.profile.ChangePasswordPopupWindow) Command(com.vaadin.ui.MenuBar.Command) MenuBar(com.vaadin.ui.MenuBar) MenuItem(com.vaadin.ui.MenuBar.MenuItem) LoggedInUser(org.activiti.explorer.identity.LoggedInUser)

Aggregations

MenuBar (com.vaadin.ui.MenuBar)1 Command (com.vaadin.ui.MenuBar.Command)1 MenuItem (com.vaadin.ui.MenuBar.MenuItem)1 LoggedInUser (org.activiti.explorer.identity.LoggedInUser)1 ChangePasswordPopupWindow (org.activiti.explorer.ui.profile.ChangePasswordPopupWindow)1