List of usage examples for com.vaadin.ui FormLayout FormLayout
public FormLayout()
From source file:annis.gui.admin.ImportPanel.java
License:Apache License
public ImportPanel() { setSizeFull();/*from www .j a v a2 s. c o m*/ layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeight("100%"); layout.setMargin(true); setContent(layout); FormLayout form = new FormLayout(); layout.addComponent(form); cbOverwrite = new CheckBox("Overwrite existing corpus"); form.addComponent(cbOverwrite); txtMail = new TextField("e-mail address for status updates"); txtMail.addValidator(new EmailValidator("Must be a valid e-mail address")); form.addComponent(txtMail); txtAlias = new TextField("alias name"); form.addComponent(txtAlias); HorizontalLayout actionBar = new HorizontalLayout(); actionBar.setSpacing(true); actionBar.setWidth("100%"); upload = new Upload("", this); upload.setButtonCaption("Upload ZIP file with relANNIS corpus and start import"); upload.setImmediate(true); upload.addStartedListener(this); upload.addFinishedListener(this); upload.setEnabled(true); actionBar.addComponent(upload); progress = new ProgressBar(); progress.setIndeterminate(true); progress.setVisible(false); actionBar.addComponent(progress); lblProgress = new Label(); lblProgress.setWidth("100%"); actionBar.addComponent(lblProgress); actionBar.setExpandRatio(lblProgress, 1.0f); actionBar.setComponentAlignment(lblProgress, Alignment.MIDDLE_LEFT); actionBar.setComponentAlignment(upload, Alignment.MIDDLE_LEFT); actionBar.setComponentAlignment(progress, Alignment.MIDDLE_LEFT); layout.addComponent(actionBar); btDetailedLog = new Button(); btDetailedLog.setStyleName(BaseTheme.BUTTON_LINK); btDetailedLog.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { setLogVisible(!isLogVisible()); } }); layout.addComponent(btDetailedLog); txtMessages = new TextArea(); txtMessages.setSizeFull(); txtMessages.setValue(""); txtMessages.setReadOnly(true); layout.addComponent(txtMessages); layout.setExpandRatio(txtMessages, 1.0f); setLogVisible(false); appendMessage("Ready."); }
From source file:annis.gui.admin.NewPasswordWindow.java
License:Apache License
public NewPasswordWindow(final String userName, final List<UserListView.Listener> listeners) { setCaption("Set new password for user \"" + userName + "\""); setModal(true);//from ww w. j a v a 2 s . c om FormLayout layout = new FormLayout(); setContent(layout); final PasswordField txtPassword1 = new PasswordField("Enter new password"); final PasswordField txtPassword2 = new PasswordField("Repeat new password"); txtPassword1.setValidationVisible(true); txtPassword1.setRequired(true); txtPassword2.addValidator(new Validator() { @Override public void validate(Object value) throws Validator.InvalidValueException { String asString = (String) value; if (asString != null && !asString.equals(txtPassword1.getValue())) { throw new InvalidValueException("Passwords are not the same"); } } }); txtPassword2.setRequired(true); txtPassword2.setValidationVisible(true); Button btOk = new Button("Ok"); btOk.setClickShortcut(ShortcutAction.KeyCode.ENTER); btOk.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { txtPassword1.validate(); txtPassword2.validate(); if (txtPassword1.isValid() && txtPassword2.isValid()) { for (UserListView.Listener l : listeners) { l.passwordChanged(userName, txtPassword1.getValue()); } UI.getCurrent().removeWindow(NewPasswordWindow.this); Notification.show("Password for user \"" + userName + "\" was changed"); } else { } } catch (Validator.InvalidValueException ex) { Notification n = new Notification("Validation failed", ex.getHtmlMessage(), Type.ERROR_MESSAGE, true); n.show(Page.getCurrent()); } } }); Button btCancel = new Button("Cancel"); btCancel.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().removeWindow(NewPasswordWindow.this); } }); HorizontalLayout actionLayout = new HorizontalLayout(btOk, btCancel); layout.addComponent(txtPassword1); layout.addComponent(txtPassword2); layout.addComponent(actionLayout); }
From source file:annis.gui.ExportPanel.java
License:Apache License
public ExportPanel(QueryPanel queryPanel, QueryController controller, QueryUIState state) { super(2, 3);// ww w . ja va2 s.co m this.queryPanel = queryPanel; this.controller = controller; this.state = state; this.eventBus = new EventBus(); this.eventBus.register(ExportPanel.this); this.formLayout = new FormLayout(); formLayout.setWidth("-1px"); setWidth("99%"); setHeight("-1px"); initHelpMessages(); setColumnExpandRatio(0, 0.0f); setColumnExpandRatio(1, 1.0f); cbExporter = new ComboBox("Exporter"); cbExporter.setNewItemsAllowed(false); cbExporter.setNullSelectionAllowed(false); cbExporter.setImmediate(true); for (Exporter e : SearchView.EXPORTER) { cbExporter.addItem(e.getClass().getSimpleName()); } cbExporter.setValue(SearchView.EXPORTER[0].getClass().getSimpleName()); cbExporter.addValueChangeListener(new ExporterSelectionHelpListener()); formLayout.addComponent(cbExporter); addComponent(formLayout, 0, 0); lblHelp = new Label(help4Exporter.get((String) cbExporter.getValue())); lblHelp.setContentMode(ContentMode.HTML); addComponent(lblHelp, 1, 0); cbLeftContext = new ComboBox("Left Context"); cbRightContext = new ComboBox("Right Context"); cbLeftContext.setNullSelectionAllowed(false); cbRightContext.setNullSelectionAllowed(false); cbLeftContext.setNewItemsAllowed(true); cbRightContext.setNewItemsAllowed(true); cbLeftContext .addValidator(new IntegerRangeValidator("must be a number", Integer.MIN_VALUE, Integer.MAX_VALUE)); cbRightContext .addValidator(new IntegerRangeValidator("must be a number", Integer.MIN_VALUE, Integer.MAX_VALUE)); for (Integer i : SearchOptionsPanel.PREDEFINED_CONTEXTS) { cbLeftContext.addItem(i); cbRightContext.addItem(i); } cbLeftContext.setValue(5); cbRightContext.setValue(5); formLayout.addComponent(cbLeftContext); formLayout.addComponent(cbRightContext); txtAnnotationKeys = new TextField("Annotation Keys"); txtAnnotationKeys.setDescription("Some exporters will use this comma " + "seperated list of annotation keys to limit the exported data to these " + "annotations."); formLayout.addComponent(new HelpButton(txtAnnotationKeys)); txtParameters = new TextField("Parameters"); txtParameters.setDescription( "You can input special parameters " + "for certain exporters. See the description of each exporter " + "(? button above) for specific parameter settings."); formLayout.addComponent(new HelpButton(txtParameters)); btExport = new Button("Perform Export"); btExport.setIcon(FontAwesome.PLAY); btExport.setDisableOnClick(true); btExport.addClickListener(new ExportButtonListener()); btCancel = new Button("Cancel Export"); btCancel.setIcon(FontAwesome.TIMES_CIRCLE); btCancel.setEnabled(false); btCancel.addClickListener(new CancelButtonListener()); btCancel.setVisible(SearchView.EXPORTER[0].isCancelable()); btDownload = new Button("Download"); btDownload.setDescription("Click here to start the actual download."); btDownload.setIcon(FontAwesome.DOWNLOAD); btDownload.setDisableOnClick(true); btDownload.setEnabled(false); HorizontalLayout layoutExportButtons = new HorizontalLayout(btExport, btCancel, btDownload); addComponent(layoutExportButtons, 0, 1, 1, 1); VerticalLayout vLayout = new VerticalLayout(); addComponent(vLayout, 0, 2, 1, 2); progressBar = new ProgressBar(); progressBar.setVisible(false); progressBar.setIndeterminate(true); vLayout.addComponent(progressBar); progressLabel = new Label(); vLayout.addComponent(progressLabel); if (state != null) { cbLeftContext.setPropertyDataSource(state.getLeftContext()); cbRightContext.setPropertyDataSource(state.getRightContext()); cbExporter.setPropertyDataSource(state.getExporterName()); state.getExporterName().setValue(SearchView.EXPORTER[0].getClass().getSimpleName()); txtAnnotationKeys.setConverter(new CommaSeperatedStringConverterList()); txtAnnotationKeys.setPropertyDataSource(state.getExportAnnotationKeys()); txtParameters.setPropertyDataSource(state.getExportParameters()); } }
From source file:at.peppol.webgui.app.components.InvoiceForm.java
License:Mozilla Public License
public Form createInvoiceTopForm() { final Form invoiceTopForm = new Form(new FormLayout(), new InvoiceFieldFactory()); invoiceTopForm.setImmediate(true);// w w w . jav a 2 s.c o m parent.getInvoice().setID(new IDType()); invoiceTopForm.addItemProperty("Invoice ID", new NestedMethodProperty(parent.getInvoice().getID(), "value")); parent.getInvoice().setDocumentCurrencyCode(new DocumentCurrencyCodeType()); // invoice.getDocumentCurrencyCode().setValue("EUR"); parent.getInvoice().setIssueDate(new IssueDateType()); invoiceTopForm.addItemProperty("Currency", new NestedMethodProperty(parent.getInvoice().getDocumentCurrencyCode(), "value")); final Date issueDate = new Date(); invoiceTopForm.addItemProperty("Issue Date", new ObjectProperty<Date>(issueDate)); return invoiceTopForm; }
From source file:at.peppol.webgui.app.components.InvoiceLineWindow.java
License:Mozilla Public License
public Form createInvoiceLineForm() throws Exception { final Form invoiceLineForm = new Form(new FormLayout(), new InvoiceFieldFactory()); invoiceLineForm.setImmediate(true);//from ww w . jav a 2 s. c om invln = new InvoiceLineAdapter(); //1. Line ID invln.setID(new IDType()); invoiceLineForm.addItemProperty("lineId", new NestedMethodProperty(invln, "ID.value")); //2. Seller's ID invoiceLineForm.addItemProperty("sellersItemId", new NestedMethodProperty(invln, "sellersItemID")); //3. Line Item's Name invoiceLineForm.addItemProperty("itemName", new NestedMethodProperty(invln, "item.name.value")); //0. invoiceLineForm.addItemProperty ("notes", new NestedMethodProperty (invln, "notes")); //4. Line Item's Description invoiceLineForm.addItemProperty("itemDescription", new NestedMethodProperty(invln, "itemDescription")); //5. Line Item's Quantity invoiceLineForm.addItemProperty("invoicedQuantity", new NestedMethodProperty(invln, "invoicedQuantity.value")); //6. Line Item's Price invoiceLineForm.addItemProperty("priceAmount", new NestedMethodProperty(invln, "priceAmount")); return invoiceLineForm; }
From source file:at.peppol.webgui.app.components.TabInvoiceDelivery.java
License:Mozilla Public License
public Form createInvoiceDeliveryTopForm() { final Form invoiceDeliveryTopForm = new Form(new FormLayout(), new InvoiceDeliveryFieldFactory()); invoiceDeliveryTopForm.setImmediate(true); final Date actualDeliveryDate = new Date(); invoiceDeliveryTopForm.addItemProperty("Actual Delivery Date", new ObjectProperty<Date>(actualDeliveryDate)); invoiceDeliveryTopForm.addItemProperty("Delivery Location ID", new NestedMethodProperty(deliveryItem.getDeliveryLocation().getID(), "value")); // The following replaced by AddressDetailForm /*/* w w w . ja v a 2 s .c om*/ invoiceDeliveryTopForm.addItemProperty ("Address Street Name", new NestedMethodProperty(deliveryItem.getDeliveryLocation().getAddress (), "streetName.value") ); invoiceDeliveryTopForm.addItemProperty ("Address Additional Street Name", new NestedMethodProperty(deliveryItem.getDeliveryLocation().getAddress (), "additionalStreetName.value") ); invoiceDeliveryTopForm.addItemProperty ("Address Department", new NestedMethodProperty(deliveryItem.getDeliveryLocation().getAddress (), "department.value") ); invoiceDeliveryTopForm.addItemProperty ("Address Building Number", new NestedMethodProperty(deliveryItem.getDeliveryLocation().getAddress (), "buildingNumber.value") ); invoiceDeliveryTopForm.addItemProperty ("Address City Name", new NestedMethodProperty(deliveryItem.getDeliveryLocation().getAddress (), "cityName.value") ); invoiceDeliveryTopForm.addItemProperty ("Address Postal Zone", new NestedMethodProperty(deliveryItem.getDeliveryLocation().getAddress (), "postalZone.value") ); invoiceDeliveryTopForm.addItemProperty ("Address Country Subentity", new NestedMethodProperty(deliveryItem.getDeliveryLocation().getAddress (), "countrySubentity.value") ); invoiceDeliveryTopForm.addItemProperty ("Address Country ID", new NestedMethodProperty(deliveryItem.getDeliveryLocation().getAddress (), "country.identificationCode.value") ); */ return invoiceDeliveryTopForm; }
From source file:at.peppol.webgui.app.components.TabInvoiceHeader.java
License:Mozilla Public License
public Form createInvoiceTopForm() { final Form invoiceTopForm = new Form(new FormLayout(), new InvoiceFieldFactory()); invoiceTopForm.setImmediate(true);// ww w.j av a 2 s . co m invoiceTopForm.setSizeFull(); if (parent.getInvoice().getID() == null) parent.getInvoice().setID(new IDType()); invoiceTopForm.addItemProperty("Invoice ID", new NestedMethodProperty(parent.getInvoice().getID(), "value")); if (parent.getInvoice().getDocumentCurrencyCode() == null) parent.getInvoice().setDocumentCurrencyCode(new DocumentCurrencyCodeType()); //parent.getInvoice().getDocumentCurrencyCode().setValue("EUR"); invoiceTopForm.addItemProperty("Currency", new NestedMethodProperty(parent.getInvoice().getDocumentCurrencyCode(), "value")); Date issueDate = new Date(); if (parent.getInvoice().getIssueDate() == null) { parent.getInvoice().setIssueDate(new IssueDateType()); invoiceTopForm.addItemProperty("Issue Date", new ObjectProperty<Date>(issueDate)); } else { invoiceTopForm.addItemProperty("Issue Date", new ObjectProperty<Date>( parent.getInvoice().getIssueDate().getValue().toGregorianCalendar().getTime())); } if (parent.getInvoice().getNote().size() == 0) parent.getInvoice().getNote().add(new NoteType()); invoiceTopForm.addItemProperty("Invoice Note", new NestedMethodProperty(parent.getInvoice().getNote().get(0), "value")); if (parent.getInvoice().getTaxPointDate() == null) { parent.getInvoice().setTaxPointDate(new TaxPointDateType()); invoiceTopForm.addItemProperty("Tax Point Date", new ObjectProperty<Date>(issueDate)); } else { invoiceTopForm.addItemProperty("Tax Point Date", new ObjectProperty<Date>( parent.getInvoice().getTaxPointDate().getValue().toGregorianCalendar().getTime())); } if (parent.getInvoice().getAccountingCost() == null) parent.getInvoice().setAccountingCost(new AccountingCostType()); invoiceTopForm.addItemProperty("Accounting Cost", new NestedMethodProperty(parent.getInvoice().getAccountingCost(), "value")); if (parent.getInvoice().getInvoicePeriod().size() == 0) { parent.getInvoice().getInvoicePeriod().add(new PeriodType()); parent.getInvoice().getInvoicePeriod().get(0).setStartDate(new StartDateType()); invoiceTopForm.addItemProperty("Invoice Period Start Date", new ObjectProperty<Date>(issueDate)); parent.getInvoice().getInvoicePeriod().get(0).setEndDate(new EndDateType()); invoiceTopForm.addItemProperty("Invoice Period End Date", new ObjectProperty<Date>(issueDate)); } else { invoiceTopForm.addItemProperty("Invoice Period Start Date", new ObjectProperty<Date>(parent.getInvoice() .getInvoicePeriod().get(0).getStartDate().getValue().toGregorianCalendar().getTime())); invoiceTopForm.addItemProperty("Invoice Period End Date", new ObjectProperty<Date>(parent.getInvoice() .getInvoicePeriod().get(0).getEndDate().getValue().toGregorianCalendar().getTime())); } return invoiceTopForm; }
From source file:at.peppol.webgui.app.components.TabInvoiceHeader.java
License:Mozilla Public License
public Form createInvoiceOrderReferenceForm() { final Form invoiceOrderRefForm = new Form(new FormLayout(), new InvoiceFieldFactory()); invoiceOrderRefForm.setImmediate(true); OrderReferenceType rt = new OrderReferenceType(); rt.setID(new IDType()); parent.getInvoice().setOrderReference(rt); //DocumentReferenceType dr = new DocumentReferenceType (); //dr.setID (new IDType ()); //dr.setDocumentType (new DocumentTypeType ()); //parent.getInvoice().getContractDocumentReference ().add (dr); invoiceOrderRefForm.addItemProperty("Order Reference ID", new NestedMethodProperty(parent.getInvoice().getOrderReference().getID(), "value")); //invoiceOrderRefForm.addItemProperty ("Document Reference ID", new NestedMethodProperty (parent.getInvoice().getContractDocumentReference ().get(0).getID (), "value")); //invoiceOrderRefForm.addItemProperty ("Document Reference Type", new NestedMethodProperty (parent.getInvoice().getContractDocumentReference ().get(0).getDocumentType (), "value")); return invoiceOrderRefForm; }
From source file:at.peppol.webgui.app.components.TabInvoiceLine.java
License:Mozilla Public License
public Form createGridLayoutInvoiceLineForm() { Form form = new Form() { HorizontalLayout layout = new HorizontalLayout(); Panel pricePanel = new Panel("Price"); FormLayout f1 = new FormLayout(); FormLayout f2 = new FormLayout(); Label label = new Label("<h4>Allowances/Charges</h4>", Label.CONTENT_XHTML); {//from ww w. jav a 2s . c o m layout.setSpacing(true); layout.setMargin(true); setLayout(layout); HorizontalLayout h = new HorizontalLayout(); h.setWidth("50px"); pricePanel.setStyleName("light"); layout.addComponent(f1); layout.addComponent(h); layout.addComponent(pricePanel); pricePanel.addComponent(f2); } @Override protected void attachField(Object propertyId, Field field) { //field.setCaption(null); if ("Line Note".equals(propertyId) || "Invoiced Quantity".equals(propertyId) || "Line Extension Amount".equals(propertyId) || "Accounting Cost".equals(propertyId) || "Tax Total Amount".equals(propertyId) || "Item Description".equals(propertyId) || "Item Name".equals(propertyId) || "Sellers Item ID".equals(propertyId) || "Tax Category ID".equals(propertyId) || "Tax Category Percent".equals(propertyId) || "Standard Item ID".equals(propertyId) || "Tax Scheme ID".equals(propertyId) || "Measurement Unit".equals(propertyId)) { f1.addComponent(field); } else if ("Price Allowance/Charge Indicator".equals(propertyId) || "Price Allowance/Charge Reason".equals(propertyId) || "Price Allowance/Charge Multiplier Factor".equals(propertyId) || "Price Allowance/Charge Amount".equals(propertyId) || "Price Allowance/Charge Base Amount".equals(propertyId)) { if (f2.getComponentIndex(label) == -1) f2.addComponent(label); if ("Price Allowance/Charge Reason".equals(propertyId)) field.setCaption("Reason"); else if ("Price Allowance/Charge Multiplier Factor".equals(propertyId)) field.setCaption("Multiplier Factor"); else if ("Price Allowance/Charge Amount".equals(propertyId)) field.setCaption("Amount"); else if ("Price Allowance/Charge Base Amount".equals(propertyId)) field.setCaption("Base Amount"); f2.addComponent(field); } else { //for price amount and base quantity f2.addComponent(field); } } }; return form; }
From source file:at.peppol.webgui.app.components.TabInvoiceMonetaryTotal.java
License:Mozilla Public License
public Form createInvoiceMonetaryTotalTopForm() { final Form invoiceMonetaryTotalTopForm = new Form(new FormLayout(), new InvoiceMonetaryTotalFieldFactory()); invoiceMonetaryTotalTopForm.setImmediate(true); // TODO: Update fields automatically. Make them read only ! invoiceMonetaryTotalTopForm.addItemProperty(lineExtensionAmount, new NestedMethodProperty(monetaryTotal.getLineExtensionAmount(), "value")); invoiceMonetaryTotalTopForm.addItemProperty(taxExclusiveAmount, new NestedMethodProperty(monetaryTotal.getTaxExclusiveAmount(), "value")); invoiceMonetaryTotalTopForm.addItemProperty(taxInclusiveAmount, new NestedMethodProperty(monetaryTotal.getTaxInclusiveAmount(), "value")); invoiceMonetaryTotalTopForm.addItemProperty(allowanceTotalAmount, new NestedMethodProperty(monetaryTotal.getAllowanceTotalAmount(), "value")); invoiceMonetaryTotalTopForm.addItemProperty(chargeTotalAmount, new NestedMethodProperty(monetaryTotal.getChargeTotalAmount(), "value")); invoiceMonetaryTotalTopForm.addItemProperty(prepaidAmount, new NestedMethodProperty(monetaryTotal.getPrepaidAmount(), "value")); invoiceMonetaryTotalTopForm.addItemProperty(payableRoundingAmount, new NestedMethodProperty(monetaryTotal.getPayableRoundingAmount(), "value")); invoiceMonetaryTotalTopForm.addItemProperty(payableAmount, new NestedMethodProperty(monetaryTotal.getPayableAmount(), "value")); return invoiceMonetaryTotalTopForm; }