public void initializePanelRigth() { lstStudentSelecteds = new ListSelect("Alumnos Asignados"); lstStudentSelecteds.setSizeFull(); lstStudentSelecteds.setMultiSelect(true); mainPanel.addComponent(lstStudentSelecteds); mainPanel.setExpandRatio(lstStudentSelecteds, new Float(0.45)); }
public void initializePanelLeft() { txtSearch = new TextField(); txtSearch.setWidth("100%"); txtSearch.setHeight("100%"); txtSearch.addListener( new TextChangeListener() { private static final long serialVersionUID = 1L; public void textChange(TextChangeEvent event) { String filter = event.getText(); search(filter); } }); btnSearch.setStyleName("searchButton"); btnSearch.setDescription("Buscar"); HorizontalLayout pnlSearch = new HorizontalLayout(); pnlSearch.setWidth("100%"); pnlSearch.setHeight("100%"); pnlSearch.setMargin(false); pnlSearch.addComponent(txtSearch); pnlSearch.addComponent(btnSearch); lstStudents = new ListSelect("Alumnos Disponibles"); lstStudents.setSizeFull(); lstStudents.setMultiSelect(true); // panel left VerticalLayout pnlLeft = new VerticalLayout(); pnlLeft.setHeight("100%"); pnlLeft.setWidth("100%"); pnlLeft.addComponent(pnlSearch); pnlLeft.addComponent(lstStudents); pnlLeft.setMargin(false); pnlLeft.setExpandRatio(pnlSearch, new Float(0.08)); pnlLeft.setExpandRatio(lstStudents, new Float(0.92)); mainPanel.addComponent(pnlLeft); mainPanel.setExpandRatio(pnlLeft, new Float(0.45)); }
private DataBinder<MarathonData> showOverviewData(final FormLayout layout) { layout.setMargin(true); final BeanFieldGroup<MarathonData> binder = new BeanFieldGroup<MarathonData>(MarathonData.class); layout.addComponent(binder.buildAndBind("Veranstaltung", "marathonName")); final BeanItemContainer<String> categoryListContainer = new BeanItemContainer<String>(String.class); final ListSelect categoryListSelect = new ListSelect("Kategorieen", categoryListContainer); categoryListSelect.setNewItemsAllowed(true); categoryListSelect.setNullSelectionAllowed(false); categoryListSelect.setMultiSelect(false); layout.addComponent(categoryListSelect); final Button removeItemButton = new Button("Kategorie löschen"); layout.addComponent(removeItemButton); removeItemButton.addClickListener( new ClickListener() { @Override public void buttonClick(final ClickEvent event) { categoryListContainer.removeItem(categoryListSelect.getValue()); } }); // final ListSelect categoryList = new ListSelect("Kategorieen"); // layout.addComponent(categoryList); final BeanItemContainer<DriverData> driverContainer = new BeanItemContainer<DriverData>(DriverData.class); final Table table = new Table("Fahrer"); table.setContainerDataSource(driverContainer); table.removeContainerProperty("smallSheets"); table.removeContainerProperty("startTimes"); table.removeContainerProperty("category"); table.addGeneratedColumn( "Kategorie", new ColumnGenerator() { @Override public Object generateCell( final Table source, final Object itemId, final Object columnId) { final ComboBox comboBox = new ComboBox(); comboBox.setContainerDataSource(categoryListContainer); final DriverData driverData = (DriverData) itemId; final String category = driverData.getCategory() == null ? "" : driverData.getCategory(); final ObjectProperty<String> property = new ObjectProperty<String>(category); comboBox.setPropertyDataSource(property); property.addValueChangeListener( new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { driverData.setCategory(property.getValue()); } }); return comboBox; } }); table.addGeneratedColumn( "Generieren", new ColumnGenerator() { @Override public Object generateCell( final Table source, final Object itemId, final Object columnId) { final DriverData driverData = (DriverData) itemId; final Button button = new Button("PDF"); button.addClickListener( new ClickListener() { @Override public void buttonClick(final ClickEvent event) { // showPdfHandler.showPdf(driverData.getName()); } }); return button; } }); table.addGeneratedColumn("Phase A Zettel", createPhaseCheckbox(Phase.A)); table.addGeneratedColumn("Phase D Zettel", createPhaseCheckbox(Phase.D)); table.addGeneratedColumn("Phase E Zettel", createPhaseCheckbox(Phase.E)); final DurationFieldFactory fieldFactory = new DurationFieldFactory(); table.addGeneratedColumn("Phase A Start", createPhaseStartInput(fieldFactory, Phase.A)); table.addGeneratedColumn("Phase D Start", createPhaseStartInput(fieldFactory, Phase.D)); table.addGeneratedColumn("Phase E Start", createPhaseStartInput(fieldFactory, Phase.E)); table.addGeneratedColumn( "Fahrer Löschen", new ColumnGenerator() { @Override public Object generateCell( final Table source, final Object itemId, final Object columnId) { final Button button = new Button("-"); button.addClickListener( new ClickListener() { @Override public void buttonClick(final ClickEvent event) { driverContainer.removeItem(itemId); } }); return button; } }); table.setEditable(true); table.setSortEnabled(false); // table.setNullSelectionAllowed(true); layout.addComponent(table); final Button addDriverButton = new Button("Neuer Fahrer"); addDriverButton.addClickListener( new ClickListener() { @Override public void buttonClick(final ClickEvent event) { final DriverData driver = new DriverData(); driver.setName("Fahrer - " + driverContainer.size()); driverContainer.addBean(driver); } }); layout.addComponent(addDriverButton); return new DataBinder<MarathonData>() { private MarathonData data; @Override public void bindData(final MarathonData data) { this.data = data; binder.setItemDataSource(data); categoryListContainer.removeAllItems(); for (final String category : data.getCategories()) { categoryListContainer.addBean(category); } driverContainer.removeAllItems(); for (final DriverData driver : data.getDrivers().values()) { driverContainer.addBean(driver); } } @Override public void commitHandler() { try { binder.commit(); final List<String> categories = data.getCategories(); categories.clear(); categories.addAll(categoryListContainer.getItemIds()); final Map<String, DriverData> drivers = data.getDrivers(); drivers.clear(); for (final DriverData driver : driverContainer.getItemIds()) { drivers.put(driver.getName(), driver); } } catch (final CommitException e) { throw new RuntimeException("Cannot commit", e); } } @Override public MarathonData getCurrentData() { return data; } }; }
private void buildView() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Painting PurchaseEnquiry UI"); // Initialization for Purchase Enquire Details user input components tfEnqNo = new TextField("Enquiry No"); tfEnqNo.setMaxLength(40); tfEnqQty = new TextField(); tfEnqQty.setValue("0"); tfEnqQty.setWidth("90"); dfDueDate = new GERPPopupDateField("Due Date"); dfDueDate.setInputPrompt("Select Date"); dfEnqDate = new GERPPopupDateField("Enquiry Date"); dfEnqDate.setInputPrompt("Select Date"); taEnqDtlRem = new TextArea("Remarks"); taEnqDtlRem.setMaxLength(40); taEnqDtlRem.setWidth("150"); taEnqDtlRem.setHeight("50"); taEnqRem = new TextArea("Remarks"); taEnqRem.setHeight("50"); taEnqDtlRem.setMaxLength(100); cbBranch = new GERPComboBox("Branch Name"); cbBranch.setItemCaptionPropertyId("branchName"); loadBranchList(); try { ApprovalSchemaDM obj = serviceSmsPurEnqHdr.getReviewerId(companyid, appScreenId, branchId, roleId).get(0); if (obj.getApprLevel().equals("Approver")) { cbEnqStatus = new GERPComboBox("Status", BASEConstants.T_SMS_P_ENQUIRY_HDR, BASEConstants.RP_STATUS); } else { cbEnqStatus = new GERPComboBox( "Status", BASEConstants.T_SMS_P_ENQUIRY_HDR, BASEConstants.PE_STATUS_RV); } } catch (Exception e) { logger.info(e.getMessage()); } cbEnqStatus.setWidth("120"); cbEnqDtlStatus = new GERPComboBox("Status", BASEConstants.M_GENERIC_TABLE, BASEConstants.M_GENERIC_COLUMN); lsProduct = new ListSelect("Product Name"); lsProduct.setItemCaptionPropertyId("prodname"); lsProduct.setMultiSelect(true); loadProduct(); lsProduct.setImmediate(true); lsProduct.addValueChangeListener( new ValueChangeListener() { /** */ private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { String[] split = lsProduct .getValue() .toString() .replaceAll("\\[", "") .replaceAll("\\]", "") .split(","); for (String obj : split) { if (obj.trim().length() > 0) { cbUom.setReadOnly(false); cbUom.setValue( serviceProduct .getProductList( companyid, Long.valueOf(obj.trim()), null, null, null, null, null, "F") .get(0) .getUom()); cbUom.setReadOnly(true); } } } }); cbUom = new TextField(); cbUom.setWidth("77"); cbUom.setHeight("23"); lsVendorName = new ListSelect("Vendor Name "); lsVendorName.setMultiSelect(true); lsVendorName.setItemCaptionPropertyId("vendorName"); loadVendorList(); lsVendorName.setWidth("150"); lsVendorName.setHeight("75"); hlSearchLayout = new GERPAddEditHLayout(); assembleSearchLayout(); hlSrchContainer.addComponent(GERPPanelGenerator.createPanel(hlSearchLayout)); resetFields(); loadSrchRslt(); loadPurDtl(); btnaddSpec.setStyleName("add"); btnaddSpec.addClickListener( new ClickListener() { // Click Listener for Add and Update private static final long serialVersionUID = 6551953728534136363L; @Override public void buttonClick(ClickEvent event) { if (dtlValidation()) { saveEnqDtl(); } } }); btndelete.setEnabled(false); // ClickListener for Enquire Detail Tale tblSmsEnqDtl.addItemClickListener( new ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(ItemClickEvent event) { if (tblSmsEnqDtl.isSelected(event.getItemId())) { tblSmsEnqDtl.setImmediate(true); btnaddSpec.setCaption("Add"); btnaddSpec.setStyleName("savebt"); btndelete.setEnabled(false); enqDtlresetFields(); } else { ((AbstractSelect) event.getSource()).select(event.getItemId()); btnaddSpec.setCaption("Update"); btnaddSpec.setStyleName("savebt"); btndelete.setEnabled(true); editSmsPurDetail(); } } }); btndelete.addClickListener( new ClickListener() { // Click Listener for Add and Update private static final long serialVersionUID = 6551953728534136363L; @Override public void buttonClick(ClickEvent event) { if (btndelete == event.getButton()) { deleteDetails(); } } }); }