List of usage examples for com.vaadin.ui ComboBox ComboBox
protected ComboBox(DataCommunicator<T> dataCommunicator)
From source file:pl.exsio.ca.module.terrain.report.CaReportModule.java
License:Open Source License
protected ComboBox createReportChooser() { ComboBox chooser = new ComboBox(t("pick")); final BeanItemContainer<Report> container = new BeanItemContainer(Report.class); for (Report report : this.reportRegistry.getRegisteredReports()) { container.addBean(report);/*from w ww .j a v a 2 s . c o m*/ } chooser.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); chooser.setItemCaptionPropertyId("name"); chooser.setContainerDataSource(container); chooser.setWidth("300px"); chooser.setNullSelectionAllowed(false); chooser.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (event.getProperty().getValue() != null) { if (lastReport instanceof Report) { removeComponent(lastReport); } lastReport = container.getItem(event.getProperty().getValue()).getBean(); addComponent(lastReport.load()); setExpandRatio(lastReport, 20); } } }); return chooser; }