List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout
public VerticalLayout()
From source file:at.peppol.webgui.app.MainWindow.java
License:Mozilla Public License
@SuppressWarnings("serial") private void initUI() { final VerticalLayout root = new VerticalLayout(); root.setMargin(false);/*from www. j a v a 2 s .c o m*/ setContent(root); // createTopBar(); // Changed with menuBar -- under testing createMenuBar(); // Changed with custom layout using bootstrap -- under testing // createHeaderMenu(); final UserFolder<File> userFolder = new UserFolder<File>(); final long polling = 20000; int draftInvoicesNum = um.countItemsInSpace(um.getDrafts()); int inboxInvoicesNum = um.countItemsInSpace(um.getInbox()); int outboxInvoicesNum = um.countItemsInSpace(um.getOutbox()); //Buttons final NativeButton inboxInvoices = new NativeButton("Invoices (" + inboxInvoicesNum + ")"); final NativeButton outboxInvoices = new NativeButton("Invoices (" + outboxInvoicesNum + ")"); final NativeButton draftInvoices = new NativeButton("Invoices (" + draftInvoicesNum + ")"); //thread final Thread tFolderCount = new Thread(new Runnable() { @Override public void run() { try { while (true) { int countDrafts = um.countItemsInSpace(um.getDrafts()); int countInbox = um.countItemsInSpace(um.getInbox()); int countOutbox = um.countItemsInSpace(um.getOutbox()); synchronized (MainWindow.this.getApplication()) { String labelD = draftInvoices.getCaption(); labelD = labelD.replaceFirst("[\\d]+", "" + countDrafts); draftInvoices.setCaption(labelD); String labelI = inboxInvoices.getCaption(); labelI = labelI.replaceFirst("[\\d]+", "" + countInbox); inboxInvoices.setCaption(labelI); String labelO = outboxInvoices.getCaption(); labelO = labelO.replaceFirst("[\\d]+", "" + countOutbox); outboxInvoices.setCaption(labelO); itemsPanel.reloadTable(userFolder); } Thread.sleep(polling); } } catch (InterruptedException e) { System.out.println("Thread folders interrupted!!!"); } } }); // ------ START: Left NavBar ------- final CssLayout leftNavBar = new CssLayout(); leftNavBar.setStyleName("sidebar-menu"); leftNavBar.setSizeFull(); leftNavBar.setWidth("220px"); // User theUser = (User) getApplication().getUser(); final Label homeLbl = new Label("HOME"); homeLbl.addStyleName("blue"); leftNavBar.addComponent(homeLbl); leftNavBar.addComponent(new Label("INBOX")); final NativeButton catalogueBtn = new NativeButton("Catalogue"); leftNavBar.addComponent(catalogueBtn); leftNavBar.addComponent(new NativeButton("Orders")); //leftNavBar.addComponent (new NativeButton ("Invoices")); //int inboxInvoicesNum = um.countItemsInSpace(um.getInbox()); //inboxInvoices = new NativeButton ("Invoices ("+inboxInvoicesNum+")"); inboxInvoices.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { inboxInvoices.setCaption("Invoices (" + um.countItemsInSpace(um.getInbox()) + ")"); userFolder.setFolder(um.getInbox().getFolder()); userFolder.setName(um.getInbox().getName()); showInitialMainContent(userFolder); draftInvoices.removeStyleName("v-bold-nativebuttoncaption"); } }); leftNavBar.addComponent(inboxInvoices); leftNavBar.addComponent(new Label("DRAFTS")); leftNavBar.addComponent(new NativeButton("Catalogue")); leftNavBar.addComponent(new NativeButton("Orders")); //int draftInvoicesNum = um.countItemsInSpace(um.getDrafts()); //draftInvoices = new NativeButton ("Invoices ("+draftInvoicesNum+")"); draftInvoices.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { draftInvoices.setCaption("Invoices (" + um.countItemsInSpace(um.getDrafts()) + ")"); userFolder.setFolder(um.getDrafts().getFolder()); userFolder.setName(um.getDrafts().getName()); showInitialMainContent(userFolder); draftInvoices.removeStyleName("v-bold-nativebuttoncaption"); } }); leftNavBar.addComponent(draftInvoices); leftNavBar.addComponent(new Label("OUTBOX")); leftNavBar.addComponent(new NativeButton("Catalogue")); leftNavBar.addComponent(new NativeButton("Orders")); //leftNavBar.addComponent (new NativeButton ("Invoices")); //int outboxInvoicesNum = um.countItemsInSpace(um.getOutbox()); //outboxInvoices = new NativeButton ("Invoices ("+outboxInvoicesNum+")"); outboxInvoices.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { outboxInvoices.setCaption("Invoices (" + um.countItemsInSpace(um.getOutbox()) + ")"); userFolder.setFolder(um.getOutbox().getFolder()); userFolder.setName(um.getOutbox().getName()); showInitialMainContent(userFolder); draftInvoices.removeStyleName("v-bold-nativebuttoncaption"); } }); leftNavBar.addComponent(outboxInvoices); leftNavBar.addComponent(new Label("SETTINGS")); leftNavBar.addComponent(new NativeButton("My Profile")); leftNavBar.addComponent(new NativeButton("Customers")); leftNavBar.addComponent(new NativeButton("Suppliers")); final Embedded peppolLogoImg = new Embedded(null, new ExternalResource("img/peppol_logo.png")); peppolLogoImg.setStyleName("logo"); leftNavBar.addComponent(peppolLogoImg); middleContentLayout.addComponent(leftNavBar); /*Button refreshButton = new Button("Refresh"); refreshButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { int draftInvoices = um.countItemsInSpace(um.getDrafts()); invoices.setCaption("Invoices ("+draftInvoices+")"); } }); leftNavBar.addComponent(refreshButton);*/ //workaround so that thread refreshes UI. It seems that when a ProgressIndicator is present, //all components receive server side refreshes ProgressIndicator p = new ProgressIndicator(); p.setPollingInterval((int) polling); p.setWidth("0px"); p.setHeight("0px"); leftNavBar.addComponent(p); showInitialMainContent(null); draftInvoices.click(); tFolderCount.start(); draftInvoices.addStyleName("v-bold-nativebuttoncaption"); }
From source file:at.peppol.webgui.app.MainWindow.java
License:Mozilla Public License
public void showInitialMainContent(UserFolder<?> userFolder) { // ------ START: Main Content ------- final VerticalLayout mainContentLayout = new VerticalLayout(); mainContentLayout.addStyleName("margin"); final VerticalLayout topmain = new VerticalLayout(); topmain.setSpacing(true);/*from w w w.ja v a 2s . c o m*/ topmain.setWidth("100%"); final Label bigPAWGLabel = new Label("PEPPOL Post Award Web GUI"); bigPAWGLabel.setStyleName("huge"); topmain.addComponent(bigPAWGLabel); final Label blahContent = new Label( "This is a mockup of the GUI that is going" + " to be the PAWG. It is created by the Greek" + " and Austrian teams as a fine replacement " + " of the Demo Client"); blahContent.setWidth("80%"); blahContent.addStyleName("big"); //topmain.addComponent (blahContent); //HorizontalLayout itemsPanel = new ShowItemsPanel("Items", um, userFolder); final ShowItemsPanel itemsPanel = new ShowItemsPanel("Items", um, userFolder); this.itemsPanel = itemsPanel; topmain.addComponent(itemsPanel); HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); topmain.addComponent(buttonsLayout); Button loadButton = new Button("Load invoice"); //topmain.addComponent(loadButton); buttonsLayout.addComponent(loadButton); loadButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Table table = itemsPanel.getTable(); if (table.getValue() != null) { //InvoiceType inv = (InvoiceType)table.getItem(table.getValue()).getItemProperty("invoice").getValue(); //InvoiceBean invBean = (InvoiceBean)table.getItem(table.getValue()); InvoiceBean invBean = ((InvoiceBeanContainer) table.getContainerDataSource()) .getItem(table.getValue()).getBean(); //System.out.println("Invoice is: "+invBean); showInvoiceForm(invBean); } } }); Button sendButton = new Button("Send invoice"); buttonsLayout.addComponent(sendButton); sendButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { Table table = itemsPanel.getTable(); if (table.getValue() != null) { InvoiceBean invBean = ((InvoiceBeanContainer) table.getContainerDataSource()) .getItem(table.getValue()).getBean(); String path = invBean.getFolderEntryID(); FileSystemResource s = new FileSystemResource(path); SendInvoice.sendDocument(s); //file is sent. move invoice to outbox um.moveInvoice(invBean, um.getDrafts(), um.getOutbox()); //itemsPanel.getTable().requestRepaint(); itemsPanel.init(um.getDrafts()); } } catch (FileNotFoundException e) { getWindow().showNotification("Could not find invoice file", Notification.TYPE_ERROR_MESSAGE); } catch (Exception e) { getWindow().showNotification("Could not send invoice. AP connection error", Notification.TYPE_ERROR_MESSAGE); e.printStackTrace(); } } }); final Button learnMoreBtn = new Button("Learn More >>"); learnMoreBtn.addStyleName("tall default"); //topmain.addComponent (learnMoreBtn); mainContentLayout.addComponent(topmain); // ------ END: Main Content --------- mainContentLayout.setHeight("100%"); mainContentLayout.setSizeFull(); mainContentLayout.setSpacing(true); mainContentLayout.setWidth("100%"); middleContentLayout.setWidth("100%"); middleContentLayout.setHeight("100%"); middleContentLayout.setMargin(true); // -------- addComponent(middleContentLayout); addComponent(footerLayout); if (mainContentComponent != null) { middleContentLayout.replaceComponent(mainContentComponent, mainContentLayout); } else { middleContentLayout.addComponent(mainContentLayout); } middleContentLayout.setExpandRatio(mainContentLayout, 1); mainContentComponent = mainContentLayout; }
From source file:at.punkt.lodms.web.dialog.AboutDialog.java
License:GNU General Public License
public AboutDialog() { super("About Open Data Interoperability Platform"); Label aboutText = new Label("<div class=\"lodms_about\" style=\"width:705px;white-space: normal;\">" + "<p>The Open Data Interoperability Platform (ODIP) is developed <a href=\"http://tenforce.com\">Tenforce</a> in the context of <a href=\"http://www.opendatasupport.eu\">Open Data Support</a>, a project funded by <a href=\"http://ec.europa.eu/dgs/connect/\">DG CONNECT</a> of the European Commission underSMART 2012/0107Lot 2:Provision of services for the Publication, Access and Reuse of Open Public Data across the European Union, through existing open data portals(Contract No. 30-CE-0530965/00-17).</p>" + "<p><a href=\"http://www.opendatasupport.eu\">Open Data Support</a> is run by <a href=\"http://www.pwc.com/gx/en/eu-institutions-services/index.jhtml\">PwC EU Services</a>.</p>" + "<p>The Linked (Open) Data Management Suite is developed by the <a href=\"http://www.semantic-web.at\">Semantic Web Company</a> in the course of the <a href=\"http://lod2.eu\">LOD2</a> FP7 project.</p>" + "<p>It is a Java based Linked (Open) Data Management Suite to schedule and monitor required ETL: Extract - Transform - Load</br>jobs for smooth and efficient Linked (Open) Data Management for web-based Linked Open Data portals (LOD platforms)</br>as well as for sustainable Data Management and Data Integration usage inside of the enterprise / the organisation.</p>" + "<p>Release 1.0, <a href=\"http://www.gnu.org/licenses/gpl-2.0.html\">GPLv2</a></div>", Label.CONTENT_XHTML); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from w w w .jav a 2 s. co m*/ layout.setSpacing(true); layout.addComponent(aboutText); layout.setSizeUndefined(); setContent(layout); center(); }
From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.topic.accounting.AccountingQuestionManager.java
License:LGPL
@Override public void startQuiz() { // Remove everything from the layout, save it for displaying after // clicking OK final Component[] components = new Component[getComponentCount()]; for (int i = 0; i < components.length; i++) { components[i] = getComponent(i); }/*from www .ja v a 2 s .c om*/ removeAllComponents(); // Create first page VerticalLayout layout = new VerticalLayout(); addComponent(layout); Label label = new Label("Answer all the questions like you were working for \"Unternehmen XY\"", ContentMode.HTML); Button cont = new Button("Continue", e -> { removeAllComponents(); for (Component c : components) { addComponent(c); } super.startQuiz(); }); layout.addComponent(components[0]);// Title of the quiz layout.addComponent(label); layout.addComponent(cont); layout.setComponentAlignment(components[0], Alignment.MIDDLE_CENTER); }
From source file:au.org.scoutmaster.views.ContactView.java
@Override protected VerticalLayout buildEditor(final ValidatingFieldGroup<Contact> fieldGroup2) { this.tabs.setSizeFull(); final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();//from ww w . j a va 2 s .c o m // this needs to be updated when the contact changes this.changeListener = new ChangeListener(); overviewTab(); // contactTab(); relationshipTab(); youthTab(); memberTab(); medicalTab(); backgroundTab(); logTab(); noteTab(); // googleTab(); // When a persons birth date changes recalculate their age. this.birthDate.addValueChangeListener(this.changeListener); layout.addComponent(this.tabs); // VerticalLayout c = new VerticalLayout(); // layout.addComponent(c); // layout.setExpandRatio(c, 1); return layout; }
From source file:au.org.scoutmaster.views.ContactView.java
@Override protected AbstractLayout getAdvancedSearchLayout() { final VerticalLayout advancedSearchLayout = new VerticalLayout(); advancedSearchLayout.setSpacing(true); final HorizontalLayout tagSearchLayout = new HorizontalLayout(); this.tagSearchField = new TagField("Search Tags", true); tagSearchLayout.addComponent(this.tagSearchField); tagSearchLayout.setSizeFull();//from w w w .ja va 2 s.com advancedSearchLayout.addComponent(tagSearchLayout); final HorizontalLayout stringSearchLayout = new HorizontalLayout(); stringSearchLayout.addComponent(this.searchField); stringSearchLayout.setWidth("100%"); advancedSearchLayout.addComponent(stringSearchLayout); final Button searchButton = new Button("Search"); final Action1<ClickEvent> searchClickAction = new SearchClickAction(); ButtonEventSource.fromActionOf(searchButton).subscribe(searchClickAction); advancedSearchLayout.addComponent(searchButton); advancedSearchLayout.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); return advancedSearchLayout; }
From source file:be.rvponp.build.CommitViewerUI.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { VerticalLayout layout = new VerticalLayout(); VerticalLayout infoLayout = new VerticalLayout(); layout.setSizeFull();/*from w w w. j a v a 2s. c o m*/ HorizontalLayout buildDateLayout = createBuildDateLayout(); infoLayout.addComponent(buildDateLayout); table = createCommitsTable(); files = new VerticalLayout(); Label filesLabel = new Label("Files"); VerticalLayout filesLayout = new VerticalLayout(); HorizontalLayout filtersLayout = createFiltersLayout(table, files, filesLayout); VerticalLayout tableLayout = new VerticalLayout(); tableLayout.addComponent(table); tableLayout.setSizeFull(); filesLayout.addComponent(filesLabel); filesLayout.addComponent(files); filesLayout.setVisible(false); filesLayout.setSizeFull(); infoLayout.addComponent(new Panel(filtersLayout)); infoLayout.setSizeUndefined(); layout.addComponent(infoLayout); layout.addComponent(tableLayout); layout.setExpandRatio(tableLayout, 1); layout.addComponent(filesLayout); layout.setExpandRatio(filesLayout, 0); layout.addComponent(new ExportXLSButton("Export XLS", table, fromVersion, toVersion)); layout.setMargin(true); setContent(layout); }
From source file:br.com.anteros.mobileserver.app.form.LogForm.java
License:Apache License
private void createForm() { btnRefresh = new Button("Atualizar"); btnRefresh.addListener(this); header = new VerticalLayout(); header.addComponent(btnRefresh);/*ww w . j a va 2s . c o m*/ header.setWidth("100%"); header.setComponentAlignment(btnRefresh, Alignment.MIDDLE_LEFT); addComponent(header); textPanel = new Panel(); textPanel.setImmediate(true); textPanel.setHeight("100%"); textPanel.setWidth("100%"); textLog = new Label(); textLog.setContentMode(Label.CONTENT_XHTML); textLog.setWidth("100%"); textLog.setHeight("100%"); addComponent(textPanel); textPanel.addComponent(textLog); }
From source file:br.com.anteros.mobileserver.app.form.TableForm.java
License:Apache License
private void createGrids() { layoutFields = new VerticalLayout(); layoutFields.setImmediate(false);/*from ww w .ja v a2 s . c o m*/ layoutFields.setWidth("100.0%"); layoutFields.setHeight("100.0%"); layoutFields.setMargin(false); gridFields = new Table(); gridFields.setWidth("100.0%"); gridFields.setHeight("100.0%"); gridFields.setContainerDataSource(getFieldsDataSource()); gridFields.setColumnHeaders( new String[] { "Id", "Nome campo", "Descrio", "Nome campo SQL", "Tipo de Campo", "" }); gridFields.setSizeFull(); gridFields.addListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { enableActions(); } }); gridFields.setColumnExpandRatio("NAME", 1); gridFields.setColumnWidth("ID", 70); gridFields.setColumnWidth("NAME", 300); gridFields.setColumnWidth("DESCRIPTION", 400); gridFields.setColumnWidth("SQL_FIELD_NAME", 200); gridFields.setColumnWidth("FIELD_TYPE", 200); gridFields.setColumnWidth(MobileServerData.PROPERTY_DATA, 1); gridFields.setSelectable(true); gridFields.setImmediate(true); layoutFields.addComponent(gridFields); layoutFields.setExpandRatio(gridFields, 1.0f); buttonsFields = new HorizontalLayout(); buttonsFields.setImmediate(false); buttonsFields.setWidth("100.0%"); buttonsFields.setHeight("30px"); buttonsFields.setMargin(false); buttonsFields.setSpacing(true); btnAddField = new Button(); btnAddField.setCaption("Adicionar"); btnAddField.setImmediate(false); btnAddField.setWidth("-1px"); btnAddField.setHeight("-1px"); btnAddField.setIcon(new ThemeResource("icons/16/fieldAdd.png")); btnAddField.addListener(this); buttonsFields.addComponent(btnAddField); buttonsFields.setComponentAlignment(btnAddField, new Alignment(33)); btnRemoveField = new Button(); btnRemoveField.setCaption("Remover"); btnRemoveField.setImmediate(false); btnRemoveField.setWidth("-1px"); btnRemoveField.setHeight("-1px"); btnRemoveField.setIcon(new ThemeResource("icons/16/fieldRemove.png")); btnRemoveField.addListener(this); buttonsFields.addComponent(btnRemoveField); buttonsFields.setComponentAlignment(btnRemoveField, new Alignment(33)); btnEditField = new Button(); btnEditField.setCaption("Editar"); btnEditField.setImmediate(false); btnEditField.setWidth("-1px"); btnEditField.setHeight("-1px"); btnEditField.setIcon(new ThemeResource("icons/16/fieldEdit.png")); btnEditField.addListener(this); buttonsFields.addComponent(btnEditField); buttonsFields.setComponentAlignment(btnEditField, new Alignment(33)); buttonsFields.setExpandRatio(btnEditField, 1); layoutParameters = new VerticalLayout(); layoutParameters.setImmediate(false); layoutParameters.setWidth("100.0%"); layoutParameters.setHeight("100.0%"); layoutParameters.setMargin(false); gridParameters = new Table(); gridParameters.setWidth("100.0%"); gridParameters.setHeight("100.0%"); gridParameters.setContainerDataSource(getParametersDataSource()); gridParameters.setColumnHeaders(new String[] { "Id", "Nome Parmetro", "Descrio", "Tipo Dado Parmetro", "Tipo de Parmetro", "" }); gridParameters.setSizeFull(); gridParameters.setSelectable(true); gridParameters.setImmediate(true); gridParameters.setColumnExpandRatio("NAME", 1); gridParameters.setColumnWidth("ID", 70); gridParameters.setColumnWidth("NAME", 300); gridParameters.setColumnWidth("DESCRIPTION", 400); gridParameters.setColumnWidth("PARAMETER_DATA_TYPE", 200); gridParameters.setColumnWidth("PARAMETER_TYPE", 200); gridParameters.setColumnWidth(MobileServerData.PROPERTY_DATA, 0); gridParameters.addListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { enableActions(); } }); layoutParameters.addComponent(gridParameters); layoutParameters.setExpandRatio(gridParameters, 1.0f); buttonsParameters = new HorizontalLayout(); buttonsParameters.setImmediate(false); buttonsParameters.setWidth("100.0%"); buttonsParameters.setHeight("30px"); buttonsParameters.setMargin(false); buttonsParameters.setSpacing(true); btnAddParameter = new Button(); btnAddParameter.setCaption("Adicionar"); btnAddParameter.setImmediate(false); btnAddParameter.setWidth("-1px"); btnAddParameter.setHeight("-1px"); btnAddParameter.setIcon(new ThemeResource("icons/16/parameterAdd.png")); btnAddParameter.addListener(this); buttonsParameters.addComponent(btnAddParameter); buttonsParameters.setComponentAlignment(btnAddParameter, new Alignment(33)); btnRemoveParameter = new Button(); btnRemoveParameter.setCaption("Remover"); btnRemoveParameter.setImmediate(false); btnRemoveParameter.setWidth("-1px"); btnRemoveParameter.setHeight("-1px"); btnRemoveParameter.setIcon(new ThemeResource("icons/16/parameterRemove.png")); btnRemoveParameter.addListener(this); buttonsParameters.addComponent(btnRemoveParameter); buttonsParameters.setComponentAlignment(btnRemoveParameter, new Alignment(33)); btnEditParameter = new Button(); btnEditParameter.setCaption("Editar"); btnEditParameter.setImmediate(false); btnEditParameter.setWidth("-1px"); btnEditParameter.setHeight("-1px"); btnEditParameter.setIcon(new ThemeResource("icons/16/parameterEdit.png")); btnEditParameter.addListener(this); buttonsParameters.addComponent(btnEditParameter); buttonsParameters.setComponentAlignment(btnEditParameter, new Alignment(33)); buttonsParameters.setExpandRatio(btnEditParameter, 1); }
From source file:br.com.anteros.mobileserver.app.form.UserLoginForm.java
License:Apache License
private VerticalLayout buildVerticalLayout() { verticalLayout = new VerticalLayout(); verticalLayout.setImmediate(false);/*from w w w. ja va2s. c o m*/ verticalLayout.setWidth("390px"); verticalLayout.setHeight("140px"); verticalLayout.setMargin(false); horizontalLayout = buildHorizontalLayout_1(); verticalLayout.addComponent(horizontalLayout); verticalLayout.setExpandRatio(horizontalLayout, 1.0f); verticalLayout.setComponentAlignment(horizontalLayout, new Alignment(48)); return verticalLayout; }