List of usage examples for com.vaadin.ui MenuBar setWidth
@Override public void setWidth(String width)
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/* ww w. j a 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: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 . jav a 2 s .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
static MenuBar getMenuBar() { Command click = new Command() { @Override//from w w w. j a v a 2 s. c o m public void menuSelected(MenuItem selectedItem) { Notification.show("Clicked " + selectedItem.getText()); } }; MenuBar menubar = new MenuBar(); menubar.setWidth("100%"); final MenuBar.MenuItem file = menubar.addItem("File", null); final MenuBar.MenuItem newItem = file.addItem("New", null); file.addItem("Open file...", click); file.addSeparator(); newItem.addItem("File", click); newItem.addItem("Folder", click); newItem.addItem("Project...", click); file.addItem("Close", click); file.addItem("Close All", click); file.addSeparator(); file.addItem("Save", click); file.addItem("Save As...", click); file.addItem("Save All", click); final MenuBar.MenuItem edit = menubar.addItem("Edit", null); edit.addItem("Undo", click); edit.addItem("Redo", click).setEnabled(false); edit.addSeparator(); edit.addItem("Cut", click); edit.addItem("Copy", click); edit.addItem("Paste", click); edit.addSeparator(); final MenuBar.MenuItem find = edit.addItem("Find/Replace", null); find.addItem("Google Search", click); find.addSeparator(); find.addItem("Find/Replace...", click); find.addItem("Find Next", click); find.addItem("Find Previous", click); Command check = new Command() { @Override public void menuSelected(MenuItem selectedItem) { Notification.show(selectedItem.isChecked() ? "Checked" : "Unchecked"); } }; final MenuBar.MenuItem view = menubar.addItem("View", null); view.addItem("Show Status Bar", check).setCheckable(true); MenuItem title = view.addItem("Show Title Bar", check); title.setCheckable(true); title.setChecked(true); view.addItem("Customize Toolbar...", click); view.addSeparator(); view.addItem("Actual Size", click); view.addItem("Zoom In", click); view.addItem("Zoom Out", click); TestIcon testIcon = new TestIcon(50); MenuItem fav = menubar.addItem("", check); fav.setIcon(testIcon.get()); fav.setStyleName("icon-only"); fav.setCheckable(true); fav.setChecked(true); fav = menubar.addItem("", check); fav.setIcon(testIcon.get()); fav.setStyleName("icon-only"); fav.setCheckable(true); fav.setCheckable(true); menubar.addItem("Attach", click).setIcon(FontAwesome.PAPERCLIP); menubar.addItem("Undo", click).setIcon(FontAwesome.UNDO); MenuItem redo = menubar.addItem("Redo", click); redo.setIcon(FontAwesome.REPEAT); redo.setEnabled(false); menubar.addItem("Upload", click).setIcon(FontAwesome.UPLOAD); return menubar; }
From source file:com.cavisson.gui.dashboard.components.controls.MenuBars.java
License:Apache License
static MenuBar getToolBar() { MenuBar menubar = new MenuBar(); menubar.setWidth("100%"); MenuItem fav = menubar.addItem("", null); fav.setIcon(FontAwesome.ALIGN_LEFT); fav.setStyleName("icon-only"); fav.setCheckable(true);/* w ww . j a v a 2 s . co m*/ // fav.setChecked(true); fav = menubar.addItem("", null); fav.setIcon(FontAwesome.ALIGN_CENTER); fav.setStyleName("icon-only"); fav.setCheckable(true); fav = menubar.addItem("", null); fav.setIcon(FontAwesome.ALIGN_RIGHT); fav.setStyleName("icon-only"); fav.setCheckable(true); MenuItem clip = menubar.addItem("", null); clip.setIcon(FontAwesome.PAPERCLIP); clip.setStyleName("icon-only"); MenuItem undo = menubar.addItem("", null); undo.setIcon(FontAwesome.UNDO); undo.setStyleName("icon-only"); MenuItem redo = menubar.addItem("", null); redo.setIcon(FontAwesome.REPEAT); redo.setEnabled(false); redo.setStyleName("icon-only"); return menubar; }
From source file:com.example.themes.valo.MenuBars.java
License:Apache License
static MenuBar getMenuBar() { Command click = new Command() { @Override//from w w w. ja va 2 s. c om public void menuSelected(MenuItem selectedItem) { Notification.show("Clicked " + selectedItem.getText()); } }; MenuBar menubar = new MenuBar(); menubar.setWidth("100%"); final MenuBar.MenuItem file = menubar.addItem("Draft", null); final MenuBar.MenuItem newItem = file.addItem("New", null); file.addItem("Open file...", click); file.addSeparator(); newItem.addItem("File", click); newItem.addItem("Folder", click); newItem.addItem("Project...", click); file.addItem("Close", click); file.addItem("Close All", click); file.addSeparator(); file.addItem("Save", click); file.addItem("Save As...", click); file.addItem("Save All", click); final MenuBar.MenuItem edit = menubar.addItem("Edit", null); edit.addItem("Undo", click); edit.addItem("Redo", click).setEnabled(false); edit.addSeparator(); edit.addItem("Cut", click); edit.addItem("Copy", click); edit.addItem("Paste", click); edit.addSeparator(); final MenuBar.MenuItem find = edit.addItem("Find/Replace", null); find.addItem("Google Search", click); find.addSeparator(); find.addItem("Find/Replace...", click); find.addItem("Find Next", click); find.addItem("Find Previous", click); Command check = new Command() { @Override public void menuSelected(MenuItem selectedItem) { Notification.show(selectedItem.isChecked() ? "Checked" : "Unchecked"); } }; final MenuBar.MenuItem view = menubar.addItem("View", null); view.addItem("Show Status Bar", check).setCheckable(true); MenuItem title = view.addItem("Show Title Bar", check); title.setCheckable(true); title.setChecked(true); view.addItem("Customize Toolbar...", click); view.addSeparator(); view.addItem("Actual Size", click); view.addItem("Zoom In", click); view.addItem("Zoom Out", click); TestIcon testIcon = new TestIcon(50); MenuItem fav = menubar.addItem("", check); fav.setIcon(testIcon.get()); fav.setStyleName("icon-only"); fav.setCheckable(true); fav.setChecked(true); fav = menubar.addItem("", check); fav.setIcon(testIcon.get()); fav.setStyleName("icon-only"); fav.setCheckable(true); fav.setCheckable(true); menubar.addItem("Attach", click).setIcon(FontAwesome.PAPERCLIP); menubar.addItem("Undo", click).setIcon(FontAwesome.UNDO); MenuItem redo = menubar.addItem("Redo", click); redo.setIcon(FontAwesome.REPEAT); redo.setEnabled(false); menubar.addItem("Upload", click).setIcon(FontAwesome.UPLOAD); return menubar; }
From source file:com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl.AbstractMenuItemFactoryImpl.java
License:Apache License
/** * Inits the application menu bar./*from ww w. j a v a2s . c o m*/ * * @param menuBar * the menu bar */ protected final void initApplicationMenuBar(final MenuBar menuBar) { menuBar.removeItems(); menuBar.setWidth("80%"); menuBar.setStyleName("Header"); final MenuItem mainViewItem = menuBar.addItem("Application", FontAwesome.SERVER, null); mainViewItem.addItem(START_TEXT, FontAwesome.STAR, COMMAND); final MenuItem mainItem = mainViewItem.addItem("Main", FontAwesome.STAR, null); mainItem.addItem(PAGE_VISIT_HISTORY_TEXT, FontAwesome.AREA_CHART, COMMAND18); if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN) || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) { mainViewItem.addItem(USERHOME, FontAwesome.USER, COMMAND2); createAdminMenu(mainViewItem); mainViewItem.addItem("Logout", FontAwesome.SIGN_OUT, COMMAND3); } else { mainViewItem.addItem("Login", FontAwesome.SIGN_IN, COMMAND4); mainViewItem.addItem("Register", FontAwesome.USER_PLUS, COMMAND5); } }
From source file:com.siemens.ct.osgi.vaadin.pm.main.MainApplication.java
License:Open Source License
@SuppressWarnings("serial") private MenuBar getMenu() { MenuBar menubar = new MenuBar(); menubar.setWidth("100%"); actionMenu = menubar.addItem("Action", null); actionMenu.addItem("Built-in Action...", new Command() { @Override// w w w .j ava 2s . co m public void menuSelected(MenuItem selectedItem) { main.showNotification("Built-in Action executed!"); } }); actionMenu.addSeparator(); final MenuBar.MenuItem viewMenu = menubar.addItem("Help", null); viewMenu.addItem("About...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { main.addWindow(getAboutDialog()); } }); return menubar; }
From source file:com.studiodojo.qwikinvoice.QwikInvoiceApplication.java
License:Apache License
@Override public void init() { this.mainWindow = new Window( "QwikInvoice CRM Tools - Developed by StudioDojo. Engineered by Vaadin. Powered by Google."); setMainWindow(mainWindow);/*from w ww.j a va 2 s . com*/ // // Check if a user is logged in // UserService us = UserServiceFactory.getUserService(); this.logoutURL = us.createLogoutURL(super.getURL().toExternalForm()); if (us.getCurrentUser() == null || us.getCurrentUser().getEmail() == null) { super.setLogoutURL(logoutURL); super.close(); return; } String login = us.getCurrentUser().getEmail(); this.userKey = KeyFactory.createKey(TokenBean.class.getSimpleName(), us.getCurrentUser().getEmail()); // Key ucKey = KeyFactory.createKey(UserCompanyBean.class.getSimpleName(), us.getCurrentUser().getEmail()); UserCompanyBean ucBean = UserDAO.getUserCompanyBean(us.getCurrentUser().getEmail()); this.theSession = new SessionBean(login, ucBean); // // SETUP WORKING AREA // HorizontalLayout appLayout = new HorizontalLayout(); appLayout.setSizeFull(); // The Main Layout VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setWidth(APP_WIDTH); mainLayout.setHeight(APP_HEIGHT); appLayout.addComponent(mainLayout); appLayout.setComponentAlignment(mainLayout, Alignment.TOP_CENTER); appLayout.setExpandRatio(mainLayout, 2); // // Setup Header (Welcome Message) // Label welcome = new Label( "<h1>QWIK!NVOICE</h1> You are " + (us.isUserLoggedIn() ? "logged in" : "logged out") + " as <b>" + us.getCurrentUser().getNickname() + "</b>", Label.CONTENT_XHTML); mainLayout.addComponent(welcome); mainLayout.setComponentAlignment(welcome, Alignment.TOP_LEFT); // // Menu Bar // MenuBar menuBar = new MenuBar(); menuBar.setWidth(APP_WIDTH); MenuBar.MenuItem fileMenuItem = menuBar.addItem("File", null, null); MenuItem newMenuItem = fileMenuItem.addItem("New...", null, null); newMenuItem.addItem("Invoice/Quote", new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { QwikInvoiceApplication.this.showPanel(InvoiceApplicationPanel.class); } catch (Exception e) { Log.log(Level.SEVERE, "Error loading panel", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); newMenuItem.addItem("Order", new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { QwikInvoiceApplication.this.showPanel(FFOrderApplicationPanel.class); } catch (Exception e) { Log.log(Level.SEVERE, "Error loading panel", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); /** SAVE */ fileMenuItem.addItem("Save", new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { TokenBean userTokenBean = TokenStore.getToken(QwikInvoiceApplication.this.userKey); // User must have an OAuth AUTH Token to access Google Doc service if (userTokenBean != null) { /* GDocFileWindow saveWindow = new GDocFileWindow("Save As..."); saveWindow.init(QwikInvoiceApplication.this, PdfWriter.getFilename(QwikInvoiceApplication.this.theSession)); QwikInvoiceApplication.this.mainWindow.addWindow(saveWindow); */ QwikInvoiceApplication.this.activePanel.validate(); QwikInvoiceApplication.this.activePanel.onSave(); } else { AuthSubWindow authsubWindow = new AuthSubWindow("Service Authorization Required"); authsubWindow.init(QwikInvoiceApplication.this.userKey); QwikInvoiceApplication.this.mainWindow.addWindow(authsubWindow); } } catch (Exception e) { Log.log(Level.SEVERE, "Error Saving file", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); /** * SETTINGS */ fileMenuItem.addSeparator(); MenuItem settingsMenuItem = fileMenuItem.addItem("Settings...", null, null); settingsMenuItem.addItem("Profile", new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { UserCompanySetupWindow aWindow = new UserCompanySetupWindow(); aWindow.init(QwikInvoiceApplication.this); QwikInvoiceApplication.this.mainWindow.addWindow(aWindow); } catch (Exception e) { Log.log(Level.SEVERE, "Error Saving Profile", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); fileMenuItem.addSeparator(); fileMenuItem.addItem("Logout", new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { QwikInvoiceApplication.this.setLogoutURL(logoutURL); QwikInvoiceApplication.this.close(); } }); /** * Products */ MenuBar.MenuItem productsMenuItem = menuBar.addItem("Products", null, null); productsMenuItem.addItem("Products", null, new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { QwikInvoiceApplication.this.showPanel(ProductApplicationPanel.class); } catch (Exception e) { Log.log(Level.SEVERE, "Error loading products", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); productsMenuItem.addItem("Categories", null, new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { ProductCategorySettingsWindow window = new ProductCategorySettingsWindow(); window.setCaption("Product Category"); window.init(QwikInvoiceApplication.this.theSession, QwikInvoiceApplication.this); QwikInvoiceApplication.this.mainWindow.addWindow(window); } catch (Exception e) { Log.log(Level.SEVERE, "Error Loading Products", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); productsMenuItem.addItem("Catalogs", null, new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { try { QwikInvoiceApplication.this.showPanel(CatalogApplicationPanel.class); } catch (Exception e) { Log.log(Level.SEVERE, "Error loading catalogs", e); QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(), Notification.TYPE_ERROR_MESSAGE); } } }); /** * Help */ MenuBar.MenuItem helpMenuItem = menuBar.addItem("Help", null, new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { AboutWindow aboutWindow = new AboutWindow(); aboutWindow.init(); QwikInvoiceApplication.this.mainWindow.addWindow(aboutWindow); } }); helpMenuItem.addItem("About...", null, null); mainLayout.addComponent(menuBar); mainLayout.setComponentAlignment(menuBar, Alignment.TOP_CENTER); // // Load Main Panel // IApplicationPanel invoiceApplicationPanel = (IApplicationPanel) this.map.get(InvoiceApplicationPanel.class); try { invoiceApplicationPanel.init(this.theSession, this); mainLayout.addComponent((Component) invoiceApplicationPanel); mainLayout.setComponentAlignment((Component) invoiceApplicationPanel, Alignment.TOP_CENTER); this.activePanel = invoiceApplicationPanel; } catch (Exception e) { } // // Setup Footer // //Label footerMessage = new Label("QwikInvoice <b>version "+_VERSION_+"</b>. This service is provided as is. E&O accepted. Developed by <a href='mailto:public@studiodojo.com?subject=QwikInvoice' target='_blank'>StudioDojo</a>. Engineered by Vaadin. Powered by Google. Apache License 2.0", Label.CONTENT_XHTML); //mainLayout.addComponent(footerMessage); //mainLayout.setComponentAlignment(footerMessage, Alignment.TOP_CENTER); Panel mainPanel = new Panel(); mainPanel.setScrollable(true); mainPanel.setContent(appLayout); this.mainWindow.setContent(mainPanel); }
From source file:de.fzi.fhemapi.view.vaadin.ui.HWindow.java
License:Apache License
private MenuBar buildMenuBar() { MenuBar menubar = new MenuBar(); menubar.setWidth("100%"); MenuBar.MenuItem file = menubar.addItem("Neu..", null); file.addItem("Neue Struktur", menuCommand); file.addItem("Neues Gert", menuCommand); MenuBar.MenuItem data = menubar.addItem("Dateien", null); data.addItem("ffne Config", menuCommand); data.addItem("Autocreate an", menuCommand); data.addItem("Autocreate aus", menuCommand); MenuBar.MenuItem save = menubar.addItem("Speichern", null); return menubar; }
From source file:de.informera.dev.nutchManager.MyVaadinApplication.java
License:Apache License
@Override public void init() { File settings_folder = new File(System.getProperty("user.home") + "/.nutchManager"); if (!settings_folder.isDirectory()) { settings_folder.mkdir();/* w ww . j a v a 2 s .c o m*/ new File(settings_folder.getAbsolutePath() + "/backups").mkdir(); new File(settings_folder.getAbsolutePath() + "/instances").mkdir(); } window = new Window("nutchManager"); setMainWindow(window); this.setTheme("nutchManager"); final HorizontalLayout technologies = new HorizontalLayout(); technologies.setSpacing(true); technologies.addComponent(new Embedded("", new ThemeResource("images/nutch_logo_tm.gif"))); technologies.addComponent(new Embedded("", new ThemeResource("images/vaadin.png"))); final MenuBar mainMenu = new MenuBar(); mainMenu.setWidth("100%"); MenuItem menuFile = mainMenu.addItem("File", null, null); MenuItem subMenuFile = menuFile.addItem("Add new instance", null, null); // Define a common menu command for all the menu items. MenuBar.Command addNewInstanceFromMenu = new MenuBar.Command() { public void menuSelected(MenuItem selectedItem) { window.removeAllComponents(); window.addComponent(technologies); window.addComponent(mainMenu); window.addWindow(new AddInstanceDialog()); } }; subMenuFile.setCommand(addNewInstanceFromMenu); window.addComponent(technologies); window.addComponent(mainMenu); // Begin the checkout of an old configuration // Check waether configuration has entries for nutch instances or not // File settings_folder = new File( this.getClass().getClassLoader().getResource("/instance_conf").getPath() ); File instances_folder = new File(settings_folder + "/instances"); // If not: prompt to add an instance if (instances_folder.list().length < 1) { window.showNotification("ERROR", "No previous configuration found. Please add a nutch instance.", Notification.TYPE_ERROR_MESSAGE); Window addInstance = new AddInstanceDialog(); window.addWindow(addInstance); } else { window.addComponent(new InstanceSelectionView()); } }