List of usage examples for com.vaadin.ui MenuBar MenuBar
public MenuBar()
From source file:com.jain.addon.action.ActionMenuBar.java
License:Apache License
/** * Create a segment instance having first {@link Button}, last {@link Button} and {@link Button} styles * @param secured -- {@link JNISecured}/*ww w .j a v a 2 s. com*/ * @param actionHandler * @param firstActionStyle * @param lastActionStyle */ public ActionMenuBar(JNISecured secured, T actionHandler, String firstActionStyle, String lastActionStyle, String actionStyle) { this.firstActionStyle = firstActionStyle; this.lastActionStyle = lastActionStyle; this.actionStyle = actionStyle; this.secured = secured; this.menuBar = new MenuBar(); this.listener = new JNCommandListener<T>(menuBar, false, actionHandler); this.actions = new ArrayList<JNAction>(); this.actionsToName = new HashMap<JNAction, String>(); this.actionGroupByName = new HashMap<String, JNActionGroup>(); setStyleName(JNStyleConstants.J_ACTION_BAR); }
From source file:com.klwork.explorer.project.ProjectSearchPanel.java
License:Apache License
protected void initSortMenu() { MenuBar menuBar = new MenuBar(); menuBar.addStyleName(ExplorerLayout.STYLE_SEARCHBOX_SORTMENU); //TODO: Adding types of sorting manually and listener/events MenuItem rootItem = menuBar.addItem("Sort by", null); rootItem.addItem("Id", null); rootItem.addItem("Name", null); rootItem.addItem("Due date", null); rootItem.addItem("Creation date", null); layout.addComponent(menuBar);//from w w w . j a v a 2 s .co m layout.setComponentAlignment(menuBar, Alignment.MIDDLE_RIGHT); }
From source file:com.klwork.explorer.ui.custom.ToolbarPopupEntry.java
License:Apache License
protected void initLabelComponent() { menuBar = new MenuBar(); menuBar.addStyleName(ExplorerLayout.STYLE_TOOLBAR_POPUP); rootItem = menuBar.addItem(title, null); layout.addComponent(menuBar);//from ww w . j a va 2s . c o m }
From source file:com.klwork.explorer.ui.mainlayout.MainMenuBar.java
License:Apache License
private void initProjectButton() { MenuBar helpMenu = new MenuBar(); helpMenu.addStyleName(ExplorerLayout.STYLE_HEADER_PROFILE_BOX); MenuItem rootItem = helpMenu.addItem("?", null); rootItem.setStyleName(ExplorerLayout.STYLE_HEADER_PROFILE_MENU); rootItem.addItem("", new Command() { public void menuSelected(MenuItem selectedItem) { ViewToolManager.getMainView().showProjectPage(); }//ww w . jav a2 s . c o m }); rootItem.addItem("", new Command() { public void menuSelected(MenuItem selectedItem) { ViewToolManager.getMainView().showMySchedulePage(); } }); addComponent(helpMenu); setComponentAlignment(helpMenu, Alignment.TOP_RIGHT); setExpandRatio(helpMenu, 1.0f); }
From source file:com.klwork.explorer.ui.mainlayout.MainMenuBar.java
License:Apache License
protected void initProfileButton() { final LoggedInUser user = LoginHandler.getLoggedInUser(); // LoggedInUser user = new LoggedInUser(); // 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) { ViewToolManager.showPopupWindow(new ProfilePopupWindow(user.getId())); }//from ww w. j a va 2 s.c o m }); // Edit profile rootItem.addItem("?", new Command() { public void menuSelected(MenuItem selectedItem) { ViewToolManager.showPopupWindow(new ProfilePopupWindow(user.getId())); } }); // Change password rootItem.addItem(i18nManager.getMessage(Messages.PASSWORD_CHANGE), new Command() { public void menuSelected(MenuItem selectedItem) { ViewToolManager.showPopupWindow(new ChangePasswordPopupWindow()); } }); } // Logout rootItem.addItem(i18nManager.getMessage(Messages.HEADER_LOGOUT), new Command() { public void menuSelected(MenuItem selectedItem) { // xx.close(); ViewToolManager.logout(); } }); rootItem.addSeparator(); // ? rootItem.addItem("?", new Command() { public void menuSelected(MenuItem selectedItem) { // xx.close(); // ViewToolManager.logout(); } }); // rootItem.addItem("", new Command() { public void menuSelected(MenuItem selectedItem) { // xx.close(); // ViewToolManager.logout(); } }); addComponent(profileMenu); setComponentAlignment(profileMenu, Alignment.TOP_RIGHT); // setExpandRatio(profileMenu, 1.0f); }
From source file:com.lst.deploymentautomation.vaadin.page.TodoListView.java
License:Open Source License
@SuppressWarnings("serial") @Override/*from w ww .j av a 2 s . c o m*/ protected Component createHeader(Component titleComponent) { LspsUI ui = (LspsUI) getUI(); actionBtn = new MenuBar(); actionBtn.addStyleName("menu-button-action"); actionBtn.setVisible(false); //initially hidden MenuItem actions = actionBtn.addItem("", new ThemeResource("../icons/popup-menu.png"), null); final ViewAction refreshTodos = new ViewAction() { @Override public void invoke() { toggleSelectionMode(false); container.refresh(); } }; actions.addItem(ui.getMessage("action.lock"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { lock(); } }); actions.addItem(ui.getMessage("action.annotate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoAnnotation(getSelectedTodoIds(), refreshTodos)); } }); actions.addSeparator(); actions.addItem(ui.getMessage("action.unlock"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { unlock(); } }); actions.addItem(ui.getMessage("action.reject") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoRejection(getSelectedTodoIds(), refreshTodos)); } }); actions.addItem(ui.getMessage("action.delegate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoDelegation(getSelectedTodoIds(), refreshTodos)); } }); actions.addItem(ui.getMessage("action.escalate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoEscalation(getSelectedTodoIds(), refreshTodos)); } }); selectBtn = new Button(ui.getMessage("action.select"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { toggleSelectionMode(true); } }); selectBtn.addStyleName("menu-button"); cancelBtn = new Button(ui.getMessage("action.cancel"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { toggleSelectionMode(false); } }); cancelBtn.setVisible(false); //initially hidden cancelBtn.addStyleName("menu-button"); titleComponent.addStyleName("l-content-title"); HorizontalLayout layout = new HorizontalLayout(); HorizontalLayout btnLayout = new HorizontalLayout(); layout.setWidth("100%"); layout.addComponent(titleComponent); layout.addComponent(btnLayout); layout.setSpacing(true); btnLayout.addComponent(actionBtn); btnLayout.addComponent(cancelBtn); btnLayout.addComponent(selectBtn); layout.setComponentAlignment(btnLayout, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.lst.deploymentautomation.vaadin.page.TodoView.java
License:Open Source License
@SuppressWarnings("serial") @Override/*www. j av a 2 s .c om*/ protected Component createHeader(Component titleComponent) { LspsUI ui = (LspsUI) getUI(); MenuBar menu = new MenuBar(); menu.addStyleName("menu-button-action"); MenuItem actions = menu.addItem("", new ThemeResource("../icons/popup-menu.png"), null); final ViewAction closeView = new ViewAction() { @Override public void invoke() { close(); //maybe close only if the to-do is not allocated to the user anymore } }; final ViewAction refreshAnnotations = new ViewAction() { @Override public void invoke() { Todo todo = todoService.getTodo(todoHolder.getTodo().getId()); refreshAnnotations(todo); } }; actions.addItem(ui.getMessage("action.info"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { //get fresh info Todo todo = todoService.getTodo(todoHolder.getTodo().getId()); getUI().addWindow(new TodoDetails(todo)); } }); actions.addSeparator(); actions.addItem(ui.getMessage("action.annotate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { //get fresh info Todo todo = todoService.getTodo(todoHolder.getTodo().getId()); getUI().addWindow(new TodoAnnotation(todo, refreshAnnotations)); } }); actions.addSeparator(); actions.addItem(ui.getMessage("action.unlock"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { unlock(); } }); actions.addItem(ui.getMessage("action.reject") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoRejection(todoHolder.getTodo().getId(), closeView)); } }); actions.addItem(ui.getMessage("action.delegate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoDelegation(todoHolder.getTodo().getId(), closeView)); } }); actions.addItem(ui.getMessage("action.escalate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoEscalation(todoHolder.getTodo().getId(), closeView)); } }); HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.addComponent(titleComponent); layout.setExpandRatio(titleComponent, 1); layout.addComponent(menu); layout.setComponentAlignment(menu, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.Menu.java
License:Apache License
public Menu(Navigator navigator) { this.navigator = navigator; setPrimaryStyleName(ValoTheme.MENU_ROOT); menuPart = new CssLayout(); menuPart.addStyleName(ValoTheme.MENU_PART); // header of the menu final HorizontalLayout top = new HorizontalLayout(); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); top.setSpacing(true);/*from w ww .j av a 2s.co m*/ Label title = new Label("My CRUD"); title.addStyleName(ValoTheme.LABEL_H3); title.setSizeUndefined(); Image image = new Image(null, new ThemeResource("img/table-logo.png")); image.setStyleName("logo"); top.addComponent(image); top.addComponent(title); menuPart.addComponent(top); // logout menu item MenuBar logoutMenu = new MenuBar(); logoutMenu.addItem("Logout", FontAwesome.SIGN_OUT, new Command() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuItem selectedItem) { VaadinSession.getCurrent().getSession().invalidate(); Page.getCurrent().reload(); } }); logoutMenu.addStyleName("user-menu"); menuPart.addComponent(logoutMenu); // button for toggling the visibility of the menu when on a small screen final Button showMenu = new Button("Menu", new ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) { menuPart.removeStyleName(VALO_MENU_VISIBLE); } else { menuPart.addStyleName(VALO_MENU_VISIBLE); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName(VALO_MENU_TOGGLE); showMenu.setIcon(FontAwesome.NAVICON); menuPart.addComponent(showMenu); // container for the navigation buttons, which are added by addView() menuItemsLayout = new CssLayout(); menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS); menuPart.addComponent(menuItemsLayout); addComponent(menuPart); }
From source file:com.morevaadin.vaadin7.navigation.NavigationRoot.java
License:Apache License
@Override protected void init(WrappedRequest request) { VerticalLayout layout = new VerticalLayout(); MenuBar bar = new MenuBar(); layout.addComponent(bar);/* ww w .j a v a2 s . c o m*/ Panel panel = new Panel() { { addComponent(new Label("Default")); } }; layout.addComponent(panel); setContent(layout); final Navigator navigator = new Navigator(panel); for (final String view : VIEWS) { bar.addItem(view, new Command() { @Override public void menuSelected(MenuItem selectedItem) { navigator.navigateTo(view); } }); navigator.addView(view, new ViewLayout(view)); } }
From source file:com.naoset.framework.frontend.component.profile.CustomerEditWindowView.java
@Override protected Component buildContent() { addMenuItems(new MenuBar().new MenuItem("", FontAwesome.EDIT, edit())); return new Panel(); }