List of usage examples for com.vaadin.ui MenuBar addStyleName
@Override public void addStyleName(String style)
From source file:annis.gui.resultview.ResultViewPanel.java
License:Apache License
public ResultViewPanel(AnnisUI ui, PluginSystem ps, InstanceConfig instanceConfig, DisplayedResultQuery initialQuery) { this.sui = ui; this.tokenAnnoVisible = new TreeMap<>(); this.ps = ps; this.controller = ui.getQueryController(); this.initialQuery = initialQuery; cacheResolver = Collections//from w ww. ja va 2 s. co m .synchronizedMap(new HashMap<HashSet<SingleResolverRequest>, List<ResolverEntry>>()); resultPanelList = Collections.synchronizedList(new LinkedList<SingleResultPanel>()); resultLayout = new CssLayout(); resultLayout.addStyleName("result-view-css"); Panel resultPanel = new Panel(resultLayout); resultPanel.setSizeFull(); resultPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); resultPanel.addStyleName("result-view-panel"); this.instanceConfig = instanceConfig; setSizeFull(); setMargin(false); MenuBar mbResult = new MenuBar(); mbResult.setWidth("100%"); mbResult.addStyleName("menu-hover"); addComponent(mbResult); miSegmentation = mbResult.addItem("Base text", null); miTokAnnos = mbResult.addItem("Token Annotations", null); addComponent(resultPanel); setExpandRatio(mbResult, 0.0f); setExpandRatio(resultPanel, 1.0f); paging = new PagingComponent(); addComponent(paging, 1); setComponentAlignment(paging, Alignment.TOP_CENTER); setExpandRatio(paging, 0.0f); }
From source file:by.bigvova.MainUI.java
License:Apache License
private Component buildUserMenu() { final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); final UserTo userTo = controller.getUserTo(); settingsItem = settings.addItem("", resource, null); updateUserMenu(null);//from w w w . j ava 2 s . c o m settingsItem.addItem("Edit Profile", new MenuBar.Command() { @Override public void menuSelected(final MenuBar.MenuItem selectedItem) { ProfilePreferencesWindow.open(userTo, resource, controller, pathToProfileImage); } }); settingsItem.addSeparator(); settingsItem.addItem("Sign Out", new MenuBar.Command() { @Override public void menuSelected(final MenuBar.MenuItem selectedItem) { vaadinSecurity.logout(); } }); return settings; }
From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java
License:Apache License
Panel windows() { Panel p = new Panel("Dialogs"); VerticalLayout content = new VerticalLayout() { final Window win = new Window("Window Caption"); String prevHeight = "300px"; boolean footerVisible = true; boolean autoHeight = false; boolean tabsVisible = false; boolean toolbarVisible = false; boolean footerToolbar = false; boolean toolbarLayout = false; String toolbarStyle = null; VerticalLayout windowContent() { VerticalLayout root = new VerticalLayout(); if (toolbarVisible) { MenuBar menuBar = MenuBars.getToolBar(); menuBar.setSizeUndefined(); menuBar.setStyleName(toolbarStyle); Component toolbar = menuBar; if (toolbarLayout) { menuBar.setWidth(null); HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setWidth("100%"); toolbarLayout.setSpacing(true); Label label = new Label("Tools"); label.setSizeUndefined(); toolbarLayout.addComponents(label, menuBar); toolbarLayout.setExpandRatio(menuBar, 1); toolbarLayout.setComponentAlignment(menuBar, Alignment.TOP_RIGHT); toolbar = toolbarLayout; }//from w w w . j av a 2s. co m toolbar.addStyleName("v-window-top-toolbar"); root.addComponent(toolbar); } Component content = null; if (tabsVisible) { TabSheet tabs = new TabSheet(); tabs.setSizeFull(); VerticalLayout l = new VerticalLayout(); l.addComponent(new Label( "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>", ContentMode.HTML)); l.setMargin(true); tabs.addTab(l, "Selected"); tabs.addTab(new Label(" ", ContentMode.HTML), "Another"); tabs.addTab(new Label(" ", ContentMode.HTML), "One more"); tabs.addStyleName("padded-tabbar"); tabs.addSelectedTabChangeListener(new SelectedTabChangeListener() { @Override public void selectedTabChange(final SelectedTabChangeEvent event) { try { Thread.sleep(600); } catch (InterruptedException e) { e.printStackTrace(); } } }); content = tabs; } else if (!autoHeight) { Panel p = new Panel(); p.setSizeFull(); p.addStyleName("borderless"); if (!toolbarVisible || !toolbarLayout) { p.addStyleName("scroll-divider"); } VerticalLayout l = new VerticalLayout(); l.addComponent(new Label( "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>", ContentMode.HTML)); l.setMargin(true); p.setContent(l); content = p; } else { content = new Label( "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>", ContentMode.HTML); root.setMargin(true); } root.addComponent(content); if (footerVisible) { HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.setSpacing(true); footer.addStyleName("v-window-bottom-toolbar"); Label footerText = new Label("Footer text"); footerText.setSizeUndefined(); Button ok = new Button("OK"); ok.addStyleName("primary"); Button cancel = new Button("Cancel"); footer.addComponents(footerText, ok, cancel); footer.setExpandRatio(footerText, 1); if (footerToolbar) { MenuBar menuBar = MenuBars.getToolBar(); menuBar.setStyleName(toolbarStyle); menuBar.setWidth(null); footer.removeAllComponents(); footer.addComponent(menuBar); } root.addComponent(footer); } if (!autoHeight) { root.setSizeFull(); root.setExpandRatio(content, 1); } return root; } { setSpacing(true); setMargin(true); win.setWidth("380px"); win.setHeight(prevHeight); win.setClosable(false); win.setResizable(false); win.setContent(windowContent()); win.setCloseShortcut(KeyCode.ESCAPE, null); Command optionsCommand = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (selectedItem.getText().equals("Footer")) { footerVisible = selectedItem.isChecked(); } if (selectedItem.getText().equals("Auto Height")) { autoHeight = selectedItem.isChecked(); if (!autoHeight) { win.setHeight(prevHeight); } else { prevHeight = win.getHeight() + win.getHeightUnits().toString(); win.setHeight(null); } } if (selectedItem.getText().equals("Tabs")) { tabsVisible = selectedItem.isChecked(); } if (selectedItem.getText().equals("Top")) { toolbarVisible = selectedItem.isChecked(); } if (selectedItem.getText().equals("Footer")) { footerToolbar = selectedItem.isChecked(); } if (selectedItem.getText().equals("Top layout")) { toolbarLayout = selectedItem.isChecked(); } if (selectedItem.getText().equals("Borderless")) { toolbarStyle = selectedItem.isChecked() ? "borderless" : null; } win.setContent(windowContent()); } }; MenuBar options = new MenuBar(); options.setCaption("Content"); options.addItem("Auto Height", optionsCommand).setCheckable(true); options.addItem("Tabs", optionsCommand).setCheckable(true); MenuItem option = options.addItem("Footer", optionsCommand); option.setCheckable(true); option.setChecked(true); options.addStyleName("small"); addComponent(options); options = new MenuBar(); options.setCaption("Toolbars"); options.addItem("Footer", optionsCommand).setCheckable(true); options.addItem("Top", optionsCommand).setCheckable(true); options.addItem("Top layout", optionsCommand).setCheckable(true); options.addItem("Borderless", optionsCommand).setCheckable(true); options.addStyleName("small"); addComponent(options); Command optionsCommand2 = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (selectedItem.getText().equals("Caption")) { win.setCaption(selectedItem.isChecked() ? "Window Caption" : null); } else if (selectedItem.getText().equals("Closable")) { win.setClosable(selectedItem.isChecked()); } else if (selectedItem.getText().equals("Resizable")) { win.setResizable(selectedItem.isChecked()); } else if (selectedItem.getText().equals("Modal")) { win.setModal(selectedItem.isChecked()); } } }; options = new MenuBar(); options.setCaption("Options"); MenuItem caption = options.addItem("Caption", optionsCommand2); caption.setCheckable(true); caption.setChecked(true); options.addItem("Closable", optionsCommand2).setCheckable(true); options.addItem("Resizable", optionsCommand2).setCheckable(true); options.addItem("Modal", optionsCommand2).setCheckable(true); options.addStyleName("small"); addComponent(options); final Button show = new Button("Open Window", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { getUI().addWindow(win); win.center(); win.focus(); event.getButton().setEnabled(false); } }); show.addStyleName("primary"); addComponent(show); final CheckBox hidden = new CheckBox("Hidden"); hidden.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { win.setVisible(!hidden.getValue()); } }); addComponent(hidden); win.addCloseListener(new CloseListener() { @Override public void windowClose(final CloseEvent e) { show.setEnabled(true); } }); } }; p.setContent(content); return p; }
From source file:com.cavisson.gui.dashboard.components.controls.MenuBars.java
License:Apache License
public void getTopMenuBar() { MenuBar menuBar = getMenuBar(); menuBar.addStyleName("small"); addComponent(menuBar); }
From source file:com.cavisson.gui.dashboard.components.controls.MenuBars.java
License:Apache License
public void init() { Label h1 = new Label("Menu Bars"); h1.addStyleName("h1"); addComponent(h1);//from ww w. j a va2 s .c om MenuBar menuBar = getMenuBar(); menuBar.setCaption("Normal style"); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Small style"); menuBar.addStyleName("small"); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Borderless style"); menuBar.addStyleName("borderless"); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Small borderless style"); menuBar.addStyleName("borderless"); menuBar.addStyleName("small"); addComponent(menuBar); Label h2 = new Label("Drop Down Button"); h2.addStyleName("h2"); addComponent(h2); HorizontalLayout wrap = new HorizontalLayout(); wrap.addStyleName("wrapping"); wrap.setSpacing(true); addComponent(wrap); wrap.addComponent(getMenuButton("Normal", false)); MenuBar split = getMenuButton("Small", false); split.addStyleName("small"); wrap.addComponent(split); split = getMenuButton("Borderless", false); split.addStyleName("borderless"); wrap.addComponent(split); split = getMenuButton("Themed", false); split.addStyleName("color1"); wrap.addComponent(split); split = getMenuButton("Small", false); split.addStyleName("color1"); split.addStyleName("small"); wrap.addComponent(split); h2 = new Label("Split Button"); h2.addStyleName("h2"); addComponent(h2); wrap = new HorizontalLayout(); wrap.addStyleName("wrapping"); wrap.setSpacing(true); addComponent(wrap); wrap.addComponent(getMenuButton("Normal", true)); split = getMenuButton("Small", true); split.addStyleName("small"); wrap.addComponent(split); split = getMenuButton("Borderless", true); split.addStyleName("borderless"); wrap.addComponent(split); split = getMenuButton("Themed", true); split.addStyleName("color1"); wrap.addComponent(split); split = getMenuButton("Small", true); split.addStyleName("color1"); split.addStyleName("small"); wrap.addComponent(split); }
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
public Panels() { setMargin(true);//from www. java2 s . c o m Label h1 = new Label("Panels & Layout panels"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TestIcon testIcon = new TestIcon(60); Panel panel = new Panel("Normal"); panel.setIcon(testIcon.get()); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Sized"); panel.setIcon(testIcon.get()); panel.setWidth("10em"); panel.setHeight("250px"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color1"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color2"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color3"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Borderless style"); panel.setIcon(testIcon.get()); panel.addStyleName("borderless"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Borderless + scroll divider"); panel.setIcon(testIcon.get()); panel.addStyleName("borderless"); panel.addStyleName("scroll-divider"); panel.setContent(panelContentScroll()); panel.setHeight("17em"); row.addComponent(panel); panel = new Panel("Well style"); panel.setIcon(testIcon.get()); panel.addStyleName("well"); panel.setContent(panelContent()); row.addComponent(panel); CssLayout layout = new CssLayout(); layout.setIcon(testIcon.get()); layout.setCaption("Panel style layout"); layout.addStyleName("card"); layout.addComponent(panelContent()); row.addComponent(layout); layout = new CssLayout(); layout.addStyleName("card"); row.addComponent(layout); HorizontalLayout panelCaption = new HorizontalLayout(); panelCaption.addStyleName("v-panel-caption"); panelCaption.setWidth("100%"); // panelCaption.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label label = new Label("Panel style layout"); panelCaption.addComponent(label); panelCaption.setExpandRatio(label, 1); Button action = new Button(); action.setIcon(FontAwesome.PENCIL); action.addStyleName("borderless-colored"); action.addStyleName("small"); action.addStyleName("icon-only"); panelCaption.addComponent(action); MenuBar dropdown = new MenuBar(); dropdown.addStyleName("borderless"); dropdown.addStyleName("small"); MenuItem addItem = dropdown.addItem("", FontAwesome.CHEVRON_DOWN, null); addItem.setStyleName("icon-only"); addItem.addItem("Settings", null); addItem.addItem("Preferences", null); addItem.addSeparator(); addItem.addItem("Sign Out", null); panelCaption.addComponent(dropdown); layout.addComponent(panelCaption); layout.addComponent(panelContent()); layout.setWidth("14em"); layout = new CssLayout(); layout.setIcon(testIcon.get()); layout.setCaption("Well style layout"); layout.addStyleName("well"); layout.addComponent(panelContent()); row.addComponent(layout); }
From source file:com.cavisson.gui.dashboard.components.controls.ValoThemeUI.java
License:Apache License
CssLayout buildMenu() { // Add items//from ww w. j a v a 2s . c om menuItems.put("common", "Common UI Elements"); menuItems.put("labels", "Labels"); menuItems.put("buttons-and-links", "Buttons & Links"); menuItems.put("textfields", "Text Fields"); menuItems.put("datefields", "Date Fields"); menuItems.put("comboboxes", "Combo Boxes"); menuItems.put("selects", "Selects"); menuItems.put("checkboxes", "Check Boxes & Option Groups"); menuItems.put("sliders", "Sliders & Progress Bars"); menuItems.put("colorpickers", "Color Pickers"); menuItems.put("menubars", "Menu Bars"); menuItems.put("trees", "Trees"); menuItems.put("tables", "Tables"); menuItems.put("dragging", "Drag and Drop"); menuItems.put("panels", "Panels"); menuItems.put("splitpanels", "Split Panels"); menuItems.put("tabs", "Tabs"); menuItems.put("accordions", "Accordions"); menuItems.put("popupviews", "Popup Views"); // menuItems.put("calendar", "Calendar"); menuItems.put("forms", "Forms"); final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top); menu.addComponent(createThemeSelect()); final Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); final Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); final StringGenerator sg = new StringGenerator(); final MenuItem settingsItem = settings.addItem( sg.nextString(true) + " " + sg.nextString(true) + sg.nextString(false), new ThemeResource("../tests-valo/img/profile-pic-300px.jpg"), null); settingsItem.addItem("Edit Profile", null); settingsItem.addItem("Preferences", null); settingsItem.addSeparator(); settingsItem.addItem("Sign Out", null); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); Label label = null; int count = -1; for (final Entry<String, String> item : menuItems.entrySet()) { if (item.getKey().equals("labels")) { label = new Label("Components", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } if (item.getKey().equals("panels")) { label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); count = 0; label = new Label("Containers", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } if (item.getKey().equals("forms")) { label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); count = 0; label = new Label("Other", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } final Button b = new Button(item.getValue(), new ClickListener() { @Override public void buttonClick(final ClickEvent event) { navigator.navigateTo(item.getKey()); } }); if (count == 2) { b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">123</span>"); } b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); b.setIcon(testIcon.get()); menuItemsLayout.addComponent(b); count++; } label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); return menu; }
From source file:com.etest.valo.MenuBars.java
License:Apache License
public MenuBars() { setMargin(true);//from w w w . j a v a 2 s .c o m setSpacing(true); Label h1 = new Label("Menu Bars"); h1.addStyleName("h1"); addComponent(h1); MenuBar menuBar = getMenuBar(); menuBar.setCaption("Normal style"); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Small style"); menuBar.addStyleName("small"); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Borderless style"); menuBar.addStyleName("borderless"); addComponent(menuBar); menuBar = getMenuBar(); menuBar.setCaption("Small borderless style"); menuBar.addStyleName("borderless"); menuBar.addStyleName("small"); addComponent(menuBar); Label h2 = new Label("Drop Down Button"); h2.addStyleName("h2"); addComponent(h2); HorizontalLayout wrap = new HorizontalLayout(); wrap.addStyleName("wrapping"); wrap.setSpacing(true); addComponent(wrap); wrap.addComponent(getMenuButton("Normal", false)); MenuBar split = getMenuButton("Small", false); split.addStyleName("small"); wrap.addComponent(split); split = getMenuButton("Borderless", false); split.addStyleName("borderless"); wrap.addComponent(split); split = getMenuButton("Themed", false); split.addStyleName("color1"); wrap.addComponent(split); split = getMenuButton("Small", false); split.addStyleName("color1"); split.addStyleName("small"); wrap.addComponent(split); h2 = new Label("Split Button"); h2.addStyleName("h2"); addComponent(h2); wrap = new HorizontalLayout(); wrap.addStyleName("wrapping"); wrap.setSpacing(true); addComponent(wrap); wrap.addComponent(getMenuButton("Normal", true)); split = getMenuButton("Small", true); split.addStyleName("small"); wrap.addComponent(split); split = getMenuButton("Borderless", true); split.addStyleName("borderless"); wrap.addComponent(split); split = getMenuButton("Themed", true); split.addStyleName("color1"); wrap.addComponent(split); split = getMenuButton("Small", true); split.addStyleName("color1"); split.addStyleName("small"); wrap.addComponent(split); }
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);/* w ww. jav a 2s . com*/ layout.setComponentAlignment(menuBar, Alignment.MIDDLE_RIGHT); }
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(); }/* w ww . j a va 2s .co m*/ }); rootItem.addItem("", new Command() { public void menuSelected(MenuItem selectedItem) { ViewToolManager.getMainView().showMySchedulePage(); } }); addComponent(helpMenu); setComponentAlignment(helpMenu, Alignment.TOP_RIGHT); setExpandRatio(helpMenu, 1.0f); }