List of usage examples for com.vaadin.ui VerticalLayout setSizeFull
@Override public void setSizeFull()
From source file:org.apache.usergrid.chop.webapp.view.user.GroupSubwindow.java
License:Apache License
private void initLayout() { /* Root of the user interface component tree is set */ HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); setContent(splitPanel);/*from ww w . jav a 2s . c o m*/ /* Build the component tree */ VerticalLayout leftLayout = new VerticalLayout(); splitPanel.addComponent(leftLayout); splitPanel.addComponent(editorLayout); leftLayout.addComponent(groupList); HorizontalLayout bottomLeftLayout = new HorizontalLayout(); leftLayout.addComponent(bottomLeftLayout); bottomLeftLayout.addComponent(searchField); bottomLeftLayout.addComponent(addNewGroupButton); bottomLeftLayout.addComponent(saveButton); bottomLeftLayout.addComponent(cancelButton); /* Set the contents in the left of the split panel to use all the space */ leftLayout.setSizeFull(); /* * On the left side, expand the size of the userList so that it uses * all the space left after from bottomLeftLayout */ leftLayout.setExpandRatio(groupList, 1); groupList.setSizeFull(); /* * In the bottomLeftLayout, searchField takes all the width there is * after adding addNewUserButton. The height of the layout is defined * by the tallest component. */ bottomLeftLayout.setWidth("100%"); searchField.setWidth("100%"); bottomLeftLayout.setExpandRatio(searchField, 1); /* Put a little margin around the fields in the right side editor */ editorLayout.setMargin(true); editorLayout.setVisible(false); }
From source file:org.apache.usergrid.chop.webapp.view.user.UserSubwindow.java
License:Apache License
private void initLayout() { // Root of the user interface component tree is set HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); setContent(splitPanel);//from w w w.j a v a2 s. co m // Build the component tree VerticalLayout leftLayout = new VerticalLayout(); splitPanel.addComponent(leftLayout); splitPanel.addComponent(userEditLayout); leftLayout.addComponent(userList); HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.addComponent(addNewUserButton); buttonsLayout.addComponent(saveButton); buttonsLayout.addComponent(closeButton); leftLayout.addComponent(buttonsLayout); // Set the contents in the left of the split panel to use all the space leftLayout.setSizeFull(); // On the left side, expand the size of userList so that it uses all the space left after from bottomLeftLayout leftLayout.setExpandRatio(userList, 1); userList.setSizeFull(); // Put a little margin around the fields in the right side editor userEditLayout.setMargin(true); userEditLayout.setVisible(false); }
From source file:org.asi.ui.custom.demo.CustomMenuBarDemo.java
private void init() { // Initialize our new UI component final CustomMenuBar barmenu = new CustomMenuBar(); // A top-level menu item that opens a submenu final CustomMenuItem drinks = barmenu.addItem("Beverages", null, null); drinks.setCloseable(true);/*from w w w . j av a 2 s . co m*/ drinks.setItemClickable(true); final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addComponent(barmenu); CustomMenuBar.Command mycommand = new CustomMenuBar.Command() { private static final long serialVersionUID = 4483012525105015694L; @Override public void menuSelected(CustomMenuBar.CustomMenuItem selectedItem) { Notification.show("select--" + selectedItem.getId() + "--" + selectedItem.getMenuItem().getCaption() + "--" + selectedItem.getMenuItem().getId()); } }; barmenu.addItemClickListener(new CustomMenuBar.ItemClickListener() { @Override public void itemClick(CustomMenuBar.ItemClickEvent event) { Notification.show("item--" + event.getMenuItem().getId() + "--" + event.getMenuItem().getMenuItem().getCaption() + "--" + event.getMenuItem().getMenuItem().getId()); } }); barmenu.addItemCloseClickListener(new CustomMenuBar.ItemCloseClickListener() { @Override public void itemCloseClick(CustomMenuBar.ItemCloseClickEvent event) { Notification.show("close--" + event.getMenuItem().getId() + "--" + event.getMenuItem().getMenuItem().getCaption() + "--" + event.getMenuItem().getMenuItem().getId()); if (event.getMenuItem().getParent() != null) { event.getMenuItem().getParent().removeChild(event.getMenuItem()); } else { barmenu.removeItem(event.getMenuItem()); } } }); // Submenu item with a sub-submenu CustomMenuItem hots = drinks.addItem(new MenuItemDTO("Hot"), null, null); hots.setCloseable(false); hots.setItemClickable(true); hots.addItem("Tea", null, mycommand); hots.addItem(new MenuItemDTO("Coffee"), null, mycommand); // Another submenu item with a sub-submenu CustomMenuItem colds = drinks.addItem(new MenuItemDTO("Cold"), null, null); colds.addItem(new MenuItemDTO("Milk"), null, mycommand); colds.addItem(new MenuItemDTO("Weissbier"), null, mycommand); // A sub-menu item after a separator drinks.addSeparator(); drinks.addItem(new MenuItemDTO("Quit Drinking"), null, null); // Another top-level item CustomMenuItem snacks = barmenu.addItem(new MenuItemDTO("Snacks"), null, null); snacks.addItem(new MenuItemDTO("Weisswurst"), null, mycommand); snacks.addItem(new MenuItemDTO("Bratwurst"), null, mycommand); snacks.addItem(new MenuItemDTO("Currywurst"), null, mycommand); // Yet another top-level item CustomMenuItem servs = barmenu.addItem(new MenuItemDTO("Services"), null, null); CustomMenuItem servs1 = servs.addItem(new MenuItemDTO("Car Service"), null, mycommand); servs1.setCloseable(true); servs1.setItemClickable(true); addComponent(layout); }
From source file:org.asi.ui.customcomponentdemo.demo.CustomMenuBarDemo.java
private void init() { Button menu = new Button("Main Menu"); addComponent(menu);// ww w .java 2 s .c o m menu.setDescription("Go to Main Menu"); setComponentAlignment(menu, Alignment.MIDDLE_CENTER); menu.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { getUI().getNavigator().navigateTo(Custom.NAME); } }); // Initialize our new UI component final CustomMenuBar barmenu = new CustomMenuBar(); // A top-level menu item that opens a submenu final CustomMenuItem drinks = barmenu.addItem("Beverages", null, null); drinks.setCloseable(true); drinks.setItemClickable(true); final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addComponent(barmenu); CustomMenuBar.Command mycommand = new CustomMenuBar.Command() { private static final long serialVersionUID = 4483012525105015694L; @Override public void menuSelected(CustomMenuBar.CustomMenuItem selectedItem) { Notification.show("select--" + selectedItem.getId() + "--" + selectedItem.getMenuItem().getCaption() + "--" + selectedItem.getMenuItem().getId()); } }; barmenu.addItemClickListener(new CustomMenuBar.ItemClickListener() { @Override public void itemClick(CustomMenuBar.ItemClickEvent event) { Notification.show("item--" + event.getMenuItem().getId() + "--" + event.getMenuItem().getMenuItem().getCaption() + "--" + event.getMenuItem().getMenuItem().getId()); } }); barmenu.addItemCloseClickListener(new CustomMenuBar.ItemCloseClickListener() { @Override public void itemCloseClick(CustomMenuBar.ItemCloseClickEvent event) { Notification.show("close--" + event.getMenuItem().getId() + "--" + event.getMenuItem().getMenuItem().getCaption() + "--" + event.getMenuItem().getMenuItem().getId()); if (event.getMenuItem().getParent() != null) { event.getMenuItem().getParent().removeChild(event.getMenuItem()); } else { barmenu.removeItem(event.getMenuItem()); } } }); // Submenu item with a sub-submenu CustomMenuItem hots = drinks.addItem(new MenuItemDTO("Hot"), null, null); hots.setCloseable(false); hots.setItemClickable(true); hots.addItem("Tea", null, mycommand); hots.addItem(new MenuItemDTO("Coffee"), null, mycommand); // Another submenu item with a sub-submenu CustomMenuItem colds = drinks.addItem(new MenuItemDTO("Cold"), null, null); colds.addItem(new MenuItemDTO("Milk"), null, mycommand); colds.addItem(new MenuItemDTO("Weissbier"), null, mycommand); // A sub-menu item after a separator drinks.addSeparator(); drinks.addItem(new MenuItemDTO("Quit Drinking"), null, null); // Another top-level item CustomMenuItem snacks = barmenu.addItem(new MenuItemDTO("Snacks"), null, null); snacks.addItem(new MenuItemDTO("Weisswurst"), null, mycommand); snacks.addItem(new MenuItemDTO("Bratwurst"), null, mycommand); snacks.addItem(new MenuItemDTO("Currywurst"), null, mycommand); // Yet another top-level item CustomMenuItem servs = barmenu.addItem(new MenuItemDTO("Services"), null, null); CustomMenuItem servs1 = servs.addItem(new MenuItemDTO("Car Service"), null, mycommand); servs1.setCloseable(true); servs1.setItemClickable(true); addComponent(layout); }
From source file:org.axonframework.examples.addressbook.vaadin.AddressbookApplication.java
License:Apache License
private void buildMainLayout() { setMainWindow(new Window("Address Book Demo application")); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeFull(); verticalLayout.addComponent(createToolbar()); verticalLayout.addComponent(horizontalSplit); verticalLayout.setExpandRatio(horizontalSplit, 1); horizontalSplit.setSplitPosition(150, HorizontalSplitPanel.UNITS_PIXELS); horizontalSplit.setFirstComponent(tree); tree.addListener((ItemClickEvent.ItemClickListener) this); getMainWindow().setContent(verticalLayout); setMainComponent(getListView());//from w ww. j ava 2 s. c om }
From source file:org.balisunrise.vaadin.components.header.LoginWindow.java
License:Open Source License
private void init() { setWidth("360px"); setHeight("280px"); setCaption("Entrar"); setResizable(false);//from ww w.ja va 2 s . c o m setModal(true); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); setContent(layout); userName = new TextField("Login"); userName.setWidth("90%"); layout.addComponent(userName); layout.setComponentAlignment(userName, Alignment.TOP_CENTER); password = new TextField("Senha"); password.setWidth("90%"); layout.addComponent(password); layout.setComponentAlignment(password, Alignment.TOP_CENTER); HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setWidth("90%"); buttonsLayout.setSpacing(true); layout.addComponent(buttonsLayout); layout.setComponentAlignment(buttonsLayout, Alignment.TOP_CENTER); confirm = new Button("Entrar"); confirm.addClickListener(this::confirm); confirm.setWidth("100%"); buttonsLayout.addComponent(confirm); cancel = new Button("Cancelar"); cancel.addClickListener(this::cancel); cancel.setWidth("100%"); buttonsLayout.addComponent(cancel); }
From source file:org.bitpimp.VaadinCurrencyConverter.MyVaadinApplication.java
License:Apache License
@Override protected void init(VaadinRequest request) { // Set the window or tab title getPage().setTitle("Yahoo Currency Converter"); // Create the content root layout for the UI final FormLayout content = new FormLayout(); content.setMargin(true);/* www . jav a2 s.c o m*/ final Panel panel = new Panel(content); panel.setWidth("500"); panel.setHeight("400"); final VerticalLayout root = new VerticalLayout(); root.addComponent(panel); root.setComponentAlignment(panel, Alignment.MIDDLE_CENTER); root.setSizeFull(); root.setMargin(true); setContent(root); content.addComponent(new Embedded("", new ExternalResource("https://vaadin.com/vaadin-theme/images/vaadin/vaadin-logo-color.png"))); content.addComponent(new Embedded("", new ExternalResource("http://images.wikia.com/logopedia/images/e/e4/YahooFinanceLogo.png"))); // Display the greeting final Label heading = new Label("<b>Simple Currency Converter " + "Using YQL/Yahoo Finance Service</b>", ContentMode.HTML); heading.setWidth(null); content.addComponent(heading); // Build the set of fields for the converter form final TextField fromField = new TextField("From Currency", "AUD"); fromField.setRequired(true); fromField.addValidator(new StringLengthValidator(CURRENCY_CODE_REQUIRED, 3, 3, false)); content.addComponent(fromField); final TextField toField = new TextField("To Currency", "USD"); toField.setRequired(true); toField.addValidator(new StringLengthValidator(CURRENCY_CODE_REQUIRED, 3, 3, false)); content.addComponent(toField); final TextField resultField = new TextField("Result"); resultField.setEnabled(false); content.addComponent(resultField); final TextField timeField = new TextField("Time"); timeField.setEnabled(false); content.addComponent(timeField); final Button submitButton = new Button("Submit", new ClickListener() { @Override public void buttonClick(ClickEvent event) { // Do the conversion final String result = converter.convert(fromField.getValue().toUpperCase(), toField.getValue().toUpperCase()); if (result != null) { resultField.setValue(result); timeField.setValue(new Date().toString()); } } }); content.addComponent(submitButton); // Configure the error handler for the UI UI.getCurrent().setErrorHandler(new DefaultErrorHandler() { @Override public void error(com.vaadin.server.ErrorEvent event) { // Find the final cause String cause = "<b>The operation failed :</b><br/>"; Throwable th = Throwables.getRootCause(event.getThrowable()); if (th != null) cause += th.getClass().getName() + "<br/>"; // Display the error message in a custom fashion content.addComponent(new Label(cause, ContentMode.HTML)); // Do the default error handling (optional) doDefault(event); } }); }
From source file:org.casbah.ui.CasbahMainComponent.java
License:Open Source License
public void init() throws CasbahException { VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSizeFull(); Embedded banner = new Embedded(null, new ClassResource("/images/casbah.png", parentApplication)); rootLayout.addComponent(banner);//from ww w . j a v a 2 s .co m rootLayout.setComponentAlignment(banner, Alignment.MIDDLE_CENTER); tabSheet = new TabSheet(); configView = new ConfigComponent(parentApplication, provider, casbahConfiguration); configView.init(); tabSheet.addTab(configView, "Configuration", null); caView = new MainCAView(provider, parentApplication); caView.init(); tabSheet.addTab(caView, "Certificate Authority", null); certView = new IssuedCertificateList(parentApplication, provider); certView.init(); tabSheet.addTab(certView, "Issued Certificates", null); tabSheet.setWidth("1024px"); rootLayout.addComponent(tabSheet); rootLayout.setComponentAlignment(tabSheet, Alignment.TOP_CENTER); Label footer = new Label("Copyright 2010 - Marco Sandrini - CASBaH is released under the" + "<a href=\"http://www.gnu.org/licenses/agpl-3.0-standalone.html\"> Affero GPL License v.3</a>" + " - Source Code is available through <a href=\"http://github.com/nessche/CASBaH/archives/master\">Github</a>", Label.CONTENT_XHTML); footer.setSizeUndefined(); rootLayout.addComponent(footer); rootLayout.setComponentAlignment(footer, Alignment.TOP_CENTER); setSizeFull(); setCompositionRoot(rootLayout); }
From source file:org.casbah.ui.ConfigComponent.java
License:Open Source License
public void init() throws CasbahException { VerticalLayout configInfo = new VerticalLayout(); configInfo.addComponent(new Label("CASBaH Configuration")); TextField providerType = new TextField("Provider Type", SupportedProvider.getSupportedProviderByClass(configuration.getProviderConfiguration().getClass()) .getUserFriendlyName()); providerType.setReadOnly(true);//from w w w .j a v a2s . c o m configInfo.addComponent(providerType); TextField providerVersion = new TextField("Provider Version", provider.getProviderVersion()); providerVersion.setReadOnly(true); providerVersion.setWidth("400px"); configInfo.addComponent(providerVersion); OpenSslProviderConfiguration openSslConfig = (OpenSslProviderConfiguration) configuration .getProviderConfiguration(); TextField pathToExecutable = new TextField( "Path to OpenSSL executable (empty if executable is in system path)", openSslConfig.getExecutablePath()); pathToExecutable.setReadOnly(true); configInfo.addComponent(pathToExecutable); TextField carootDir = new TextField("Certificate Authority root", openSslConfig.getCaroot()); carootDir.setReadOnly(true); configInfo.addComponent(carootDir); TextField keypass = new TextField("Password to Certificate Authority private key", openSslConfig.getKeypass()); keypass.setReadOnly(true); keypass.setSecret(true); configInfo.addComponent(keypass); configInfo.setSizeFull(); setSizeFull(); setCompositionRoot(configInfo); }
From source file:org.casbah.ui.IssuedCertificateList.java
License:Open Source License
public void init() throws CAProviderException { VerticalLayout layout = new VerticalLayout(); table = new Table(); table.addContainerProperty("Serial Number", String.class, null); table.addContainerProperty("Distinguished Name", String.class, null); table.addContainerProperty("Expiration Date", Date.class, null); refreshTable();//from ww w. ja va2 s . c o m layout.addComponent(table); table.setSizeFull(); HorizontalLayout buttons = new HorizontalLayout(); buttons.addComponent(new Button("Create Key/Certificate Pair", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { collectKeyCertificateInfo(); } catch (CasbahException e) { parentApplication.getMainWindow().showNotification( "An error prevents the creation of the certificate", Notification.TYPE_ERROR_MESSAGE); } } })); buttons.setSizeFull(); layout.addComponent(buttons); layout.setSizeFull(); setSizeFull(); setCompositionRoot(layout); }