List of usage examples for com.vaadin.ui MenuBar addStyleName
@Override public void addStyleName(String style)
From source file:org.jpos.qi.Header.java
License:Open Source License
@SuppressWarnings("unchecked") private MenuBar createMenu() { menuOptions = new LinkedHashMap<>(); MenuBar mb = new MenuBar(); mb.addStyleName(ValoTheme.MENUBAR_SMALL); mb.addStyleName(ValoTheme.MENUBAR_BORDERLESS); mb.setHtmlContentAllowed(true);/*from ww w . j ava 2s. co m*/ Element cfg = app.getXmlConfiguration(); if (cfg != null) { Element menubar = cfg.getChild("menubar"); if (menubar != null) { for (Element e : menubar.getChildren()) { addMenubarItem(mb, e); } } } userMenuItem = mb.addItem(app.getUser().getNick(), null); userMenuItem.setIcon(VaadinIcons.USER); userMenuItem.addItem("Profile", selectedItem -> { removeSelected(); app.navigateTo("/profile"); }); userMenuItem.addItem("Log Out", selectedItem -> app.logout()); return mb; }
From source file:org.jumpmind.metl.ui.views.AdminView.java
License:Open Source License
@PostConstruct protected void init() { setSizeFull();//from w w w . j a v a2 s . c o m tabbedPanel = new TabbedPanel(); HorizontalSplitPanel leftSplit = new HorizontalSplitPanel(); leftSplit.setSizeFull(); leftSplit.setSplitPosition(AppConstants.DEFAULT_LEFT_SPLIT, Unit.PIXELS); VerticalLayout container = new VerticalLayout(); container.setSizeFull(); container.addComponent(tabbedPanel); leftSplit.setSecondComponent(container); table = new TreeTable(); table.addStyleName(ValoTheme.TREETABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TREETABLE_NO_STRIPES); table.addStyleName(ValoTheme.TREETABLE_NO_VERTICAL_LINES); table.addStyleName(ValoTheme.TREETABLE_BORDERLESS); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSizeFull(); table.setCacheRate(100); table.setPageLength(100); table.setImmediate(true); table.setSelectable(true); table.addItemClickListener(this); table.addStyleName("noselect"); table.addContainerProperty("id", String.class, null); table.setVisibleColumns(new Object[] { "id" }); table.setColumnExpandRatio("id", 1); addItem("Users", Icons.USER); addItem("Groups", Icons.GROUP); addItem("REST", Icons.REST); addItem("General Settings", Icons.SETTINGS); addItem("Mail Server", Icons.EMAIL); addItem("Notifications", Icons.NOTIFICATION); addItem("Logging", Icons.LOGGING); addItem("About", FontAwesome.QUESTION); VerticalLayout navigator = new VerticalLayout(); navigator.addStyleName(ValoTheme.MENU_ROOT); navigator.setSizeFull(); leftSplit.setFirstComponent(navigator); MenuBar leftMenuBar = new MenuBar(); leftMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); leftMenuBar.setWidth(100, Unit.PERCENTAGE); navigator.addComponent(leftMenuBar); navigator.addComponent(table); navigator.setExpandRatio(table, 1); addComponent(leftSplit); }
From source file:org.jumpmind.metl.ui.views.DeployNavigator.java
License:Open Source License
protected HorizontalLayout buildMenuBar() { HorizontalLayout layout = new HorizontalLayout(); layout.setWidth(100, Unit.PERCENTAGE); MenuBar leftMenuBar = new MenuBar(); leftMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); leftMenuBar.setWidth(100, Unit.PERCENTAGE); MenuItem newMenu = leftMenuBar.addItem("New", null); newFolder = newMenu.addItem("Folder", new Command() { @Override/*w w w . j a v a 2 s.c o m*/ public void menuSelected(MenuItem selectedItem) { addFolder(); } }); newAgent = newMenu.addItem("Agent", new Command() { @Override public void menuSelected(MenuItem selectedItem) { addAgent(); } }); MenuItem editMenu = leftMenuBar.addItem("Edit", null); editMenu.addItem("Open", new Command() { @Override public void menuSelected(MenuItem selectedItem) { openItem(treeTable.getValue()); } }); editMenu.addItem("Rename", new Command() { @Override public void menuSelected(MenuItem selectedItem) { startEditingItem((AbstractObject) treeTable.getValue()); } }); delete = editMenu.addItem("Remove", new Command() { @Override public void menuSelected(MenuItem selectedItem) { handleDelete(); } }); MenuBar rightMenuBar = new MenuBar(); rightMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); search = rightMenuBar.addItem("", Icons.SEARCH, new Command() { @Override public void menuSelected(MenuItem selectedItem) { search.setChecked(!search.isChecked()); searchBarLayout.setVisible(search.isChecked()); } }); search.setVisible(false); layout.addComponent(leftMenuBar); layout.addComponent(rightMenuBar); layout.setExpandRatio(leftMenuBar, 1); return layout; }
From source file:org.jumpmind.metl.ui.views.DesignNavigator.java
License:Open Source License
protected HorizontalLayout buildMenuBar() { HorizontalLayout layout = new HorizontalLayout(); layout.setWidth(100, Unit.PERCENTAGE); // left menu bar MenuBar leftMenuBar = new MenuBar(); leftMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); leftMenuBar.setWidth(100, Unit.PERCENTAGE); // file menu/*from w w w. j a va2 s .c o m*/ fileMenu = leftMenuBar.addItem("File", null); // file - new newMenu = fileMenu.addItem("New", null); newFlow = newMenu.addItem("Flow", selectedItem -> addNewFlow()); newModel = newMenu.addItem("Model", selectedItem -> addNewModel()); // file - new - resource resourceMenu = newMenu.addItem("Resource", null); newDataSource = resourceMenu.addItem("Database", selectedItem -> addNewDatabase()); newFtpResource = resourceMenu.addItem("FTP", selectedItem -> addNewFtpResource()); newFileResource = resourceMenu.addItem("Local File System", selectedItem -> addNewLocalFileSystem()); newSSHResource = resourceMenu.addItem("Sftp", selectedItem -> addNewSSHFileSystem()); newWebResource = resourceMenu.addItem("Web Resource", selectedItem -> addNewHttpResource()); newJMSResource = resourceMenu.addItem("JMS", selectedItem -> addNewJMSFileSystem()); // file - export exportMenu = fileMenu.addItem("Export...", selectedItem -> export()); // file - import importConfig = fileMenu.addItem("Import...", selecteItem -> importConfig()); // edit menu editMenu = leftMenuBar.addItem("Edit", null); editMenu.addItem("Open", selectedItem -> open(treeTable.getValue())); editMenu.addItem("Rename", selectedItem -> startEditingItem((AbstractObject) treeTable.getValue())); editMenu.addItem("Copy", selectedItem -> copySelected()); delete = editMenu.addItem("Remove", selectedItem -> handleDelete()); // project menu MenuItem projectMenu = leftMenuBar.addItem("Project", null); projectMenu.addItem("Manage", selectedItem -> viewProjects()); closeProject = projectMenu.addItem("Close", selectedItem -> closeProject()); // right menu MenuBar rightMenuBar = new MenuBar(); rightMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); search = rightMenuBar.addItem("", Icons.SEARCH, new Command() { @Override public void menuSelected(MenuItem selectedItem) { search.setChecked(!search.isChecked()); searchBarLayout.setVisible(search.isChecked()); } }); search.setVisible(false); layout.addComponent(leftMenuBar); layout.addComponent(rightMenuBar); layout.setExpandRatio(leftMenuBar, 1); return layout; }
From source file:org.jumpmind.metl.ui.views.ManageNavigator.java
License:Open Source License
public ManageNavigator(FolderType folderType, ApplicationContext context) { this.context = context; setSizeFull();// w ww .jav a2 s . c o m addStyleName(ValoTheme.MENU_ROOT); VerticalLayout content = new VerticalLayout(); content.setSizeFull(); setContent(content); MenuBar leftMenuBar = new MenuBar(); leftMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); leftMenuBar.setWidth(100, Unit.PERCENTAGE); content.addComponent(leftMenuBar); treeTable = buildTreeTable(); content.addComponent(treeTable); content.setExpandRatio(treeTable, 1); agentsFolder = new Folder(); agentsFolder.setName("Agents"); flowsFolder = new Folder(); flowsFolder.setName("Flows"); }
From source file:org.jumpmind.vaadin.ui.sqlexplorer.SqlExplorer.java
License:Open Source License
protected MenuBar buildLeftMenu() { MenuBar leftMenu = new MenuBar(); leftMenu.addStyleName(ValoTheme.MENUBAR_BORDERLESS); leftMenu.setWidth(100, Unit.PERCENTAGE); MenuItem hideButton = leftMenu.addItem("", new Command() { private static final long serialVersionUID = 1L; @Override// w w w.j ava2 s . c o m public void menuSelected(MenuItem selectedItem) { savedSplitPosition = getSplitPosition() > 10 ? getSplitPosition() : DEFAULT_SPLIT_POS; setSplitPosition(0); setLocked(true); showButton.setVisible(true); } }); hideButton.setDescription("Hide the database explorer"); hideButton.setIcon(FontAwesome.BARS); MenuItem refreshButton = leftMenu.addItem("", new Command() { private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuItem selectedItem) { dbTree.refresh(); Component tab = contentTabs.getSelectedTab(); if (tab instanceof QueryPanel) { findQueryPanelForDb(((QueryPanel) tab).db).suggester.clearCaches(); } } }); refreshButton.setIcon(FontAwesome.REFRESH); refreshButton.setDescription("Refresh the database explorer"); MenuItem openQueryTab = leftMenu.addItem("", new Command() { private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuItem selectedItem) { openQueryWindow(dbTree.getSelected()); } }); openQueryTab.setIcon(QUERY_ICON); openQueryTab.setDescription("Open a query tab"); MenuItem settings = leftMenu.addItem("", new Command() { private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuItem selectedItem) { SettingsDialog dialog = new SettingsDialog(SqlExplorer.this); dialog.showAtSize(.5); } }); settings.setIcon(FontAwesome.GEAR); settings.setDescription("Modify sql explorer settings"); return leftMenu; }
From source file:org.jumpmind.vaadin.ui.sqlexplorer.TabularResultLayout.java
License:Open Source License
private void createMenuBar() { HorizontalLayout resultBar = new HorizontalLayout(); resultBar.setWidth(100, Unit.PERCENTAGE); resultBar.setMargin(new MarginInfo(false, true, false, true)); HorizontalLayout leftBar = new HorizontalLayout(); leftBar.setSpacing(true);/* ww w . j a v a 2s .com*/ resultLabel = new Label("", ContentMode.HTML); leftBar.addComponent(resultLabel); final Label sqlLabel = new Label("", ContentMode.TEXT); sqlLabel.setWidth(800, Unit.PIXELS); leftBar.addComponent(sqlLabel); resultBar.addComponent(leftBar); resultBar.setComponentAlignment(leftBar, Alignment.MIDDLE_LEFT); resultBar.setExpandRatio(leftBar, 1); MenuBar rightBar = new MenuBar(); rightBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); rightBar.addStyleName(ValoTheme.MENUBAR_SMALL); MenuBar.MenuItem refreshButton = rightBar.addItem("", new Command() { private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuBar.MenuItem selectedItem) { listener.reExecute(sql); } }); refreshButton.setIcon(FontAwesome.REFRESH); MenuBar.MenuItem exportButton = rightBar.addItem("", new Command() { private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuBar.MenuItem selectedItem) { new ExportDialog(grid, db.getName(), sql).show(); } }); exportButton.setIcon(FontAwesome.UPLOAD); if (isInQueryGeneralResults) { MenuBar.MenuItem keepResultsButton = rightBar.addItem("", new Command() { private static final long serialVersionUID = 1L; @Override public void menuSelected(com.vaadin.ui.MenuBar.MenuItem selectedItem) { queryPanel.addResultsTab(refreshWithoutSaveButton(), StringUtils.abbreviate(sql, 20), queryPanel.getGeneralResultsTab().getIcon()); queryPanel.resetGeneralResultsTab(); } }); keepResultsButton.setIcon(FontAwesome.CLONE); keepResultsButton.setDescription("Save these results to a new tab"); } if (showSql) { sqlLabel.setValue(StringUtils.abbreviate(sql, 200)); } resultBar.addComponent(rightBar); resultBar.setComponentAlignment(rightBar, Alignment.MIDDLE_RIGHT); this.addComponent(resultBar, 0); }
From source file:org.opencms.ui.sitemap.CmsSitemapTreeController.java
License:Open Source License
/** * Creates a sitemap tree node widget from a tree node bean.<p> * * @param entry the tree node bean//from w ww . java2s. c o m * @return the tree node widget */ public CmsSitemapTreeNode createNode(final CmsSitemapTreeNodeData entry) { final CmsSitemapTreeNode node = new CmsSitemapTreeNode(); node.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = 1L; @SuppressWarnings("synthetic-access") public void layoutClick(LayoutClickEvent event) { Component currentComponent = event.getClickedComponent(); if (currentComponent != null) { boolean linked = false; do { currentComponent = currentComponent.getParent(); if ((currentComponent != null) && "linked".equals(((AbstractComponent) currentComponent).getData())) { linked = true; } if (event.getClickedComponent() instanceof CmsResourceIcon) { if (currentComponent == node) { openTargetPage((CmsSitemapTreeNodeData) (node.getData()), linked); } else if (currentComponent instanceof CmsSitemapTreeNode) { break; } } } while (currentComponent != null); } } }); String icon = CmsResourceIcon.getSitemapResourceIcon(A_CmsUI.getCmsObject(), entry.getResource(), IconMode.localeCompare); CmsResourceInfo info = new CmsResourceInfo(entry.getClientEntry().getTitle(), entry.getClientEntry().getSitePath(), icon); info = CmsResourceInfo.createSitemapResourceInfo(entry.getResource(), OpenCms.getSiteManager().getSiteForRootPath(m_localeContext.getRoot().getRootPath())); info.getResourceIcon().addStyleName(OpenCmsTheme.POINTER); info.getResourceIcon() .setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_OPEN_PAGE_0)); if (entry.getClientEntry().isHiddenNavigationEntry()) { info.addStyleName(OpenCmsTheme.RESOURCE_INFO_WEAK); } final MenuBar menu = new MenuBar(); boolean noTranslation = false; noTranslation = entry.isMarkedNoTranslation(m_localeContext.getComparisonLocale()); final MenuItem main = menu.addItem("", null); main.setIcon(FontOpenCms.CONTEXT_MENU); CssLayout rightSide = new CssLayout(); info.setButtonWidget(rightSide); rightSide.addComponent(menu); main.setCommand(new Command() { /** Serial version id. */ private static final long serialVersionUID = 1L; public void menuSelected(MenuItem selectedItem) { List<I_CmsSimpleContextMenuEntry<MenuContext>> entries = Arrays.asList( new EntryOpen(), new EntryExplorer(), new EntryProperties(), new EntryLink(), new EntryUnlink(), new EntryMark(), new EntryRemoveMark(), new EntryCopy(), new EntryInfo()); MenuContext context = new MenuContext(entry, node); m_menu.setEntries(entries, context); m_menu.open(menu); } }); menu.addStyleName("borderless o-toolbar-button o-resourceinfo-toolbar"); if (entry.isLinked()) { CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(m_localeContext.getRoot().getRootPath()); CmsResourceInfo linkedInfo = CmsResourceInfo .createSitemapResourceInfo(readSitemapEntryFolderIfPossible(entry.getLinkedResource()), site); linkedInfo.addStyleName(OpenCmsTheme.RESOURCE_INFO_DIRECTLINK); rightSide.addComponent(linkedInfo, 0); linkedInfo.setWidth(RHS_WIDTH + "px"); node.setContent(info); linkedInfo.setData("linked"); // Data used by click handler to distinguish clicked resource icons linkedInfo.getResourceIcon() .setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_OPEN_PAGE_0)); linkedInfo.getResourceIcon().addStyleName(OpenCmsTheme.POINTER); } else { if (noTranslation) { CmsResourceInfo noTranslationInfo = new CmsResourceInfo(); String topMessage = CmsVaadinUtils.getMessageText(Messages.GUI_LOCALECOMPARE_NO_TRANSLATION_TOP_0); String bottomMessage = CmsVaadinUtils .getMessageText(Messages.GUI_LOCALECOMPARE_NO_TRANSLATION_BOTTOM_0); noTranslationInfo.getTopLine().setValue(topMessage); noTranslationInfo.getBottomLine().setValue(bottomMessage); noTranslationInfo.getResourceIcon().setValue("<span class=\"" + OpenCmsTheme.RESOURCE_ICON + " " + OpenCmsTheme.NO_TRANSLATION_ICON + "\">" + FontAwesome.BAN.getHtml() + "</span>"); noTranslationInfo.addStyleName(OpenCmsTheme.RESOURCE_INFO_DIRECTLINK); noTranslationInfo.setWidth(RHS_WIDTH + "px"); rightSide.addComponent(noTranslationInfo, 0); } node.setContent(info); } if (entry.hasNoChildren()) { node.setOpen(true); node.setOpenerVisible(false); } node.setData(entry); return node; }
From source file:org.vaadin.tori.util.ComponentUtil.java
License:Apache License
public static MenuBar getDropdownMenu() { final MenuBar result = new MenuBar(); MenuItem rootItem = result.addItem("", null); result.setMoreMenuItem(rootItem);//from w w w . j a va 2s. c o m result.addStyleName("dropdown"); return result; }
From source file:org.vaadin.tori.view.thread.PostComponent.java
License:Apache License
private MenuBar buildSettings() { final MenuBar settingsMenuBar = ComponentUtil.getDropdownMenu(); settingsMenuBar.addStyleName("settings"); return settingsMenuBar; }