private void populatePaymentCategories() { try { List<CategoryType> svcCategories = accSvc.getCategoriesForSheet(balSheet); categories = new LinkedHashMap<>(svcCategories.size()); paymentCategories.removeAllItems(); if (typeFrm != null) ((Select) typeFrm.getField(ADD_TYPE_FLD_CAT)).removeAllItems(); for (CategoryType cat : svcCategories) { categories.put(cat.getName(), cat); paymentCategories.addItem(cat.getName()); if (typeFrm != null) ((Select) typeFrm.getField(ADD_TYPE_FLD_CAT)).addItem(cat.getName()); } Set<String> keys = categories.keySet(); if (keys.size() > 0) paymentCategories.select(keys.iterator().next()); } catch (AccountsSheetException e) { close(); Messenger.genericMessage( MessageSeverity.ERROR, STRINGS.getString(AccountsMessages.MSGR_UNRECOVERABLE_ERROR), "Failed trying to query Payment Categories for Balance Sheet", e); } }
private void editSmsPurDetail() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Editing the selected record"); hlUserInputLayout.setVisible(true); if (tblSmsEnqDtl.getValue() != null) { SmsPurEnqDtlDM purEnqDtlDM = beanPurEnqDtlDM.getItem(tblSmsEnqDtl.getValue()).getBean(); lsProduct.setValue(null); Long prodid = purEnqDtlDM.getProductId(); Collection<?> prodids = lsProduct.getItemIds(); for (Iterator<?> iterator = prodids.iterator(); iterator.hasNext(); ) { Object itemId = (Object) iterator.next(); BeanItem<?> item = (BeanItem<?>) lsProduct.getItem(itemId); // Get the actual bean and use the data ProductDM st = (ProductDM) item.getBean(); if (prodid != null && prodid.equals(st.getProdid())) { lsProduct.select(itemId); } } if (cbUom.getValue() != null) { cbUom.setReadOnly(false); cbUom.setValue(purEnqDtlDM.getProductUom()); cbUom.setReadOnly(true); } if (tfEnqQty.getValue() != null) { tfEnqQty.setValue(purEnqDtlDM.getEnquiryQty().toString()); } if (purEnqDtlDM.getRemarks() != null) { taEnqDtlRem.setValue(purEnqDtlDM.getRemarks().toString()); } if (purEnqDtlDM.getEnqDtlStaus() != null) { cbEnqDtlStatus.setValue(purEnqDtlDM.getEnqDtlStaus()); } } }
public PaymentTypeMgmt(BalanceSheet sheet) { super(AccountsMessages.BAL_SHEET_NEW_PAY_TYPE); this.balSheet = sheet; setWidth("320px"); setIcon(IconManager.getIcon(IconManager.CATG_MGMT_SM)); accordion = new Accordion(); accordion.setSizeFull(); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); VerticalLayout vl1 = new VerticalLayout(); vl1.setSpacing(true); paymentCategories = new ListSelect(STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_CATEGORY)); populatePaymentCategories(); paymentCategories.setNullSelectionAllowed(false); paymentCategories.setImmediate(true); paymentCategories.setRows(NUM_ROWS); paymentCategories.addListener(this); Set<String> keys = categories.keySet(); if (keys.size() > 0) paymentCategories.select(keys.iterator().next()); vl1.addComponent(paymentCategories); hl.addComponent(vl1); VerticalLayout vl2 = new VerticalLayout(); vl2.setSpacing(true); paymentTypes = new ListSelect(STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_TYPE)); populatePaymentTypes(categories.get(paymentCategories.getValue())); paymentTypes.setNullSelectionAllowed(false); paymentTypes.setImmediate(true); paymentTypes.setRows(NUM_ROWS); vl2.addComponent(paymentTypes); hl.addComponent(vl2); current = accordion.addTab(hl); current.setCaption(STRINGS.getString(AccountsMessages.CURRENT)); addNewCategory = accordion.addTab(generateCreateNewCategoryForm()); addNewCategory.setCaption( STRINGS.getString(AccountsMessages.ADD_NEW) + " " + STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_CATEGORY)); addNewType = accordion.addTab(generateCreateNewTypeForm()); addNewType.setCaption( STRINGS.getString(AccountsMessages.ADD_NEW) + " " + STRINGS.getString(AccountsMessages.BAL_SHEET_PAYMENT_TYPE)); addComponent(accordion); }
// Method to edit the values from table into fields to update process private void editPurHdr() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Editing the selected record"); try { hlUserInputLayout.setVisible(true); if (tblMstScrSrchRslt.getValue() != null) { SmsPurEnqHdrDM enqHdrDM = beanPurEnqHdrDM.getItem(tblMstScrSrchRslt.getValue()).getBean(); enquiryId = enqHdrDM.getEnquiryId(); logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Selected enquiryId. Id -> " + enquiryId); logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Selected enquiryId. Id -> " + enquiryId); cbBranch.setValue(enqHdrDM.getBranchId()); tfEnqNo.setReadOnly(false); tfEnqNo.setValue(enqHdrDM.getEnquiryNo()); tfEnqNo.setReadOnly(true); dfEnqDate.setValue(enqHdrDM.getEnquiryDate()); dfDueDate.setValue(enqHdrDM.getDueDate()); for (EnquiryVendorDtlDM enquiryVendorDtlDM : serviceEnquiryVendorDtl.getpurchasevdrdtl(null, enquiryId, null)) { lsVendorName.select(enquiryVendorDtlDM.getVendorid().toString()); } if (enqHdrDM.getEnquiryStatus() != null) { cbEnqStatus.setValue(enqHdrDM.getEnquiryStatus()); } if (enqHdrDM.getEnqRemark() != null) { taEnqRem.setValue(enqHdrDM.getEnqRemark().toString()); } listEnqDtls = serviceSmsPurEnqDtl.getSmsPurEnqDtlList( null, enquiryId, null, (String) cbEnqDtlStatus.getValue()); } loadPurDtl(); comments = new SmsComments( vlTableForm, null, companyid, enquiryId, null, null, null, null, null, null, null, null, status, null); comments.loadsrch( true, null, null, enquiryId, null, null, null, null, null, null, null, null, null, null); } catch (Exception e) { logger.info(e.getMessage()); } }