List of usage examples for com.vaadin.ui MenuBar setWidth
@Override public void setWidth(float width, Unit unit)
From source file:de.gedoplan.webclients.vaadin.VaadinDemoUi.java
public MenuBar createMenu() { User user = userProvider.get();/*from w w w . j a va 2 s.c o m*/ MenuBar mainMenu = new MenuBar(); mainMenu.setWidth(100, Unit.PERCENTAGE); mainMenu.setStyleName("main"); mainMenu.addItem("", new ThemeResource("images/vaadin-logo.png"), e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_INDEX)).setStyleName("logo"); if (user.isInRole(User.UserRole.ADMIN)) { mainMenu.addItem(Messages.menu_customer.value(), e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_CUSTOMERS)); } mainMenu.addItem(Messages.menu_orders.value(), e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_ORDERS)); if (user.isInRole(User.UserRole.CUSTOMER)) { mainMenu.addItem(Messages.menu_customerdetails.value(), e -> navigator .navigateTo(Konstanten.VAADIN_VIEW_CUSTOMER_DETAILS + "/" + user.getCustomerID())); } MenuBar.MenuItem userMenu = mainMenu.addItem(user.getLogin(), null); userMenu.setStyleName("align-right"); userMenu.addItem(Messages.logout.value(), e -> { try { JaasAccessControl.logout(); VaadinSession.getCurrent().close(); Page.getCurrent().setLocation(Konstanten.VAADIN_LOGIN_PATH); } catch (ServletException ex) { Logger.getLogger(VaadinDemoUi.class.getName()).log(Level.SEVERE, null, ex); } }); return mainMenu; }
From source file:org.jumpmind.metl.ui.views.AdminView.java
License:Open Source License
@PostConstruct protected void init() { setSizeFull();//w w w .ja va 2 s. c om 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//from ww w . jav a2 s . co 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 www. j av a 2 s. c om*/ 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();/*from www. j a va2s .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/*from w ww. j av a 2s. co 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; }