/** * Constructor called by sale doc header frames. * * @param form sale doc header form * @param showDocRefLookup <code>true</code> to show combo+lookup used to select a linked document * (e.g. a sale document in an invoice document); <code>false</code> to hide combo+lookup and * show doc. ref. nr. input control * @param showSectional <code>true</code> to show the sectional field (for invoice documents); * <code>false</code> to hide that field */ public SaleIdHeadPanel(Form form, boolean showDocRefLookup, boolean showSectional) { this.showDocRefLookup = showDocRefLookup; this.showSectional = showSectional; try { jbInit(); // doc. ref. lookup... docRefDataLocator.setGridMethodName("loadSaleDocs"); docRefDataLocator.setValidationMethodName("validateSaleDocNumber"); controlDocRifLookup.setLookupController(docRefController); docRefController.setForm(form); docRefController.setLookupDataLocator(docRefDataLocator); docRefController.setFrameTitle("documents"); docRefController.setLookupValueObjectClassName( "org.jallinone.sales.documents.java.GridSaleDocVO"); docRefController.addLookup2ParentLink("companyCodeSys01DOC01", "companyCodeSys01Doc01DOC01"); docRefController.addLookup2ParentLink("docTypeDOC01", "docTypeDoc01DOC01"); docRefController.addLookup2ParentLink("docYearDOC01", "docYearDoc01DOC01"); docRefController.addLookup2ParentLink("docNumberDOC01", "docNumberDoc01DOC01"); docRefController.addLookup2ParentLink("docSequenceDOC01", "docSequenceDoc01DOC01"); docRefController.setAllColumnVisible(false); docRefController.setDomainColumn("docTypeDOC01", "SALE_DOC_TYPE"); docRefController.setPreferredWidthColumn("docStateDOC01", 60); docRefController.setPreferredWidthColumn("docTypeDOC01", 60); docRefController.setPreferredWidthColumn("docYearDOC01", 60); docRefController.setPreferredWidthColumn("docSequenceDOC01", 90); docRefController.setPreferredWidthColumn("name_1REG04", 150); docRefController.setPreferredWidthColumn("name_2REG04", 140); docRefController.setPreferredWidthColumn("docDateDOC01", 80); docRefController.setSortedColumn("companyCodeSys01DOC01", "ASC", 1); docRefController.setSortedColumn("docTypeDOC01", "ASC", 2); docRefController.setSortedColumn("docYearDOC01", "ASC", 3); docRefController.setSortedColumn("docSequenceDOC01", "ASC", 4); docRefController.setVisibleColumn("companyCodeSys01DOC01", true); docRefController.setVisibleColumn("docTypeDOC01", true); docRefController.setVisibleColumn("docYearDOC01", true); docRefController.setVisibleColumn("docSequenceDOC01", true); docRefController.setVisibleColumn("name_1REG04", true); docRefController.setVisibleColumn("name_2REG04", true); docRefController.setVisibleColumn("docDateDOC01", true); docRefController.setFramePreferedSize(new Dimension(700, 500)); docRefController.addLookupListener( new LookupListener() { public void codeValidated(boolean validated) {} public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) {} public void beforeLookupAction(ValueObject parentVO) { docRefDataLocator .getLookupFrameParams() .put(ApplicationConsts.DOC_TYPE, controlDocTypeRef.getValue()); docRefDataLocator .getLookupValidationParameters() .put(ApplicationConsts.DOC_TYPE, controlDocTypeRef.getValue()); // filter sale documents having state confirmed, i.e. not yet invoiced, except for // sale desk docs... if (ApplicationConsts.SALE_DESK_DOC_TYPE.equals(controlDocTypeRef.getValue())) { docRefDataLocator .getLookupFrameParams() .put(ApplicationConsts.DOC_STATE, ApplicationConsts.CLOSED); docRefDataLocator .getLookupValidationParameters() .put(ApplicationConsts.DOC_STATE, ApplicationConsts.CLOSED); } else { docRefDataLocator .getLookupFrameParams() .put(ApplicationConsts.DOC_STATE, ApplicationConsts.CONFIRMED); docRefDataLocator .getLookupValidationParameters() .put(ApplicationConsts.DOC_STATE, ApplicationConsts.CONFIRMED); } } public void forceValidate() {} }); } catch (Exception e) { e.printStackTrace(); } }
public SupplierDetailFrame(final SupplierController controller) { try { jbInit(); setSize(750, 550); setMinimumSize(new Dimension(750, 550)); supplierPanel.setFormController(controller); supplierPanel.setInsertButton(insertButton); supplierPanel.setEditButton(editButton); supplierPanel.setReloadButton(reloadButton); supplierPanel.setDeleteButton(deleteButton); supplierPanel.setSaveButton(saveButton); supplierPanel.setFunctionId("PUR01"); organizationPanel.setFunctionId("PUR01"); // link the parent grid to the current Form... HashSet pk = new HashSet(); pk.add("companyCodeSys01REG04"); pk.add("progressiveREG04"); supplierPanel.linkGrid( controller.getGridFrame().getGrid(), pk, true, true, true, navigatorBar); // banks lookup... bankDataLocator.setGridMethodName("loadBanks"); bankDataLocator.setValidationMethodName("validateBankCode"); controlBank.setLookupController(bankController); controlBank.setControllerMethodName("getBanksList"); bankController.setLookupDataLocator(bankDataLocator); bankController.setFrameTitle("banks"); bankController.setLookupValueObjectClassName("org.jallinone.registers.bank.java.BankVO"); bankController.addLookup2ParentLink("bankCodeREG12", "bankCodeReg12PUR01"); bankController.addLookup2ParentLink("descriptionREG12", "descriptionREG12"); bankController.setAllColumnVisible(false); bankController.setVisibleColumn("bankCodeREG12", true); bankController.setVisibleColumn("descriptionREG12", true); bankController.setPreferredWidthColumn("descriptionREG12", 200); new CustomizedColumns(new BigDecimal(232), bankController); // payments lookup... payDataLocator.setGridMethodName("loadPayments"); payDataLocator.setValidationMethodName("validatePaymentCode"); controlPayment.setLookupController(payController); controlPayment.setControllerMethodName("getPaymentsList"); payController.setLookupDataLocator(payDataLocator); payController.setFrameTitle("payments"); payController.setLookupValueObjectClassName( "org.jallinone.registers.payments.java.PaymentVO"); payController.addLookup2ParentLink("paymentCodeREG10", "paymentCodeReg10PUR01"); payController.addLookup2ParentLink("descriptionSYS10", "paymentDescriptionSYS10"); payController.setAllColumnVisible(false); payController.setVisibleColumn("paymentCodeREG10", true); payController.setVisibleColumn("descriptionSYS10", true); payController.setPreferredWidthColumn("descriptionSYS10", 200); new CustomizedColumns(new BigDecimal(212), payController); payController.addLookupListener( new LookupListener() { public void beforeLookupAction( org.openswing.swing.message.receive.java.ValueObject parentVO) { DetailSupplierVO vo = (DetailSupplierVO) parentVO; payDataLocator .getLookupValidationParameters() .put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01REG04()); payDataLocator .getLookupFrameParams() .put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01REG04()); } public void codeChanged( org.openswing.swing.message.receive.java.ValueObject parentVO, Collection parentChangedAttributes) {} public void codeValidated(boolean validated) {} public void forceValidate() {} }); // items lookup... itemDataLocator.setGridMethodName("loadItems"); itemDataLocator.setValidationMethodName("validateItemCode"); colItemCode.setLookupController(itemController); colItemCode.setControllerMethodName("getItemsList"); itemController.setLookupDataLocator(itemDataLocator); itemController.setFrameTitle("items"); itemController.setLookupValueObjectClassName("org.jallinone.items.java.GridItemVO"); itemController.addLookup2ParentLink("companyCodeSys01ITM01", "companyCodeSys01PUR02"); itemController.addLookup2ParentLink("itemCodeITM01", "itemCodeItm01PUR02"); itemController.addLookup2ParentLink("descriptionSYS10", "descriptionSYS10"); itemController.setAllColumnVisible(false); itemController.setVisibleColumn("itemCodeITM01", true); itemController.setVisibleColumn("descriptionSYS10", true); itemController.setPreferredWidthColumn("descriptionSYS10", 200); new CustomizedColumns(ApplicationConsts.ID_ITEMS_GRID, itemController); itemController.addLookupListener( new LookupListener() { public void codeValidated(boolean validated) {} public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) { GridItemVO vo = (GridItemVO) itemController.getLookupVO(); if (vo.getItemCodeITM01() != null) { SupplierItemVO supplierVO = (SupplierItemVO) parentVO; supplierVO.setSupplierItemCodePUR02(vo.getItemCodeITM01()); } } public void beforeLookupAction(ValueObject parentVO) {} public void forceValidate() {} }); // purchase um lookup... umDataLocator.setGridMethodName("loadMeasures"); umDataLocator.setValidationMethodName("validateMeasureCode"); colUmCode.setLookupController(umController); colUmCode.setControllerMethodName("getMeasureUnitsList"); umController.setLookupDataLocator(umDataLocator); umController.setFrameTitle("measures"); umController.setLookupValueObjectClassName("org.jallinone.registers.measure.java.MeasureVO"); umController.addLookup2ParentLink("umCodeREG02", "umCodeReg02PUR02"); umController.addLookup2ParentLink("decimalsREG02", "decimalsREG02"); umController.setAllColumnVisible(false); umController.setVisibleColumn("umCodeREG02", true); umController.setVisibleColumn("decimalsREG02", true); new CustomizedColumns(ApplicationConsts.ID_UM_GRID, umController); umController.addLookupListener( new LookupListener() { public void codeValidated(boolean validated) {} public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) { MeasureVO vo = (MeasureVO) umController.getLookupVO(); if (vo.getUmCodeREG02() != null) { colMinQty.setDecimals(vo.getDecimalsREG02().intValue()); colMultipleQty.setDecimals(vo.getDecimalsREG02().intValue()); SupplierItemVO supplierVO = (SupplierItemVO) parentVO; if (supplierVO.getMinPurchaseQtyPUR02() != null) supplierVO.setMinPurchaseQtyPUR02( supplierVO .getMinPurchaseQtyPUR02() .setScale(vo.getDecimalsREG02().intValue(), BigDecimal.ROUND_HALF_UP)); if (supplierVO.getMultipleQtyPUR02() != null) supplierVO.setMultipleQtyPUR02( supplierVO .getMultipleQtyPUR02() .setScale(vo.getDecimalsREG02().intValue(), BigDecimal.ROUND_HALF_UP)); } } public void beforeLookupAction(ValueObject parentVO) {} public void forceValidate() {} }); itemsGrid.setController(new SupplierItemsController(this)); itemsGrid.setGridDataLocator(itemsGridDataLocator); itemsGridDataLocator.setServerMethodName("loadSupplierItems"); treePanel.addHierarTreeListener( new HierarTreeListener() { public void loadDataCompleted(boolean error) { if (treePanel.getTree().getRowCount() > 0) treePanel.getTree().setSelectionRow(0); if (treePanel.getTree().getSelectionPath() != null) controller.leftClick( (DefaultMutableTreeNode) treePanel.getTree().getSelectionPath().getLastPathComponent()); } }); treePanel.setTreeController(controller); treePanel.setFunctionId("PUR01"); init(); itemsGrid.enableDrag(ApplicationConsts.ID_SUPPLIER_ITEMS_GRID.toString()); // debit account code lookup... controlDebitsCode.setLookupController(debitController); controlDebitsCode.setControllerMethodName("getAccounts"); debitController.setLookupDataLocator(debitDataLocator); debitDataLocator.setGridMethodName("loadAccounts"); debitDataLocator.setValidationMethodName("validateAccountCode"); debitController.setFrameTitle("accounts"); debitController.setAllowTreeLeafSelectionOnly(false); debitController.setLookupValueObjectClassName( "org.jallinone.accounting.accounts.java.AccountVO"); debitController.addLookup2ParentLink("accountCodeACC02", "debitAccountCodeAcc02PUR01"); debitController.addLookup2ParentLink("descriptionSYS10", "debitAccountDescrPUR01"); debitController.setFramePreferedSize(new Dimension(400, 400)); debitController.setAllColumnVisible(false); debitController.setVisibleColumn("accountCodeACC02", true); debitController.setVisibleColumn("descriptionSYS10", true); debitController.setFilterableColumn("accountCodeACC02", true); debitController.setFilterableColumn("descriptionSYS10", true); debitController.setSortedColumn("accountCodeACC02", "ASC", 1); debitController.setSortableColumn("accountCodeACC02", true); debitController.setSortableColumn("descriptionSYS10", true); debitController.setPreferredWidthColumn("accountCodeACC02", 100); debitController.setPreferredWidthColumn("descriptionSYS10", 290); debitController.addLookupListener( new LookupListener() { public void codeValidated(boolean validated) {} public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) {} public void beforeLookupAction(ValueObject parentVO) { debitDataLocator .getLookupFrameParams() .put(ApplicationConsts.COMPANY_CODE_SYS01, controlCompanyCode.getValue()); debitDataLocator .getLookupValidationParameters() .put(ApplicationConsts.COMPANY_CODE_SYS01, controlCompanyCode.getValue()); } public void forceValidate() {} }); // costs account code lookup... controlCostsCode.setLookupController(costsController); controlCostsCode.setControllerMethodName("getAccounts"); costsController.setLookupDataLocator(costsDataLocator); costsDataLocator.setGridMethodName("loadAccounts"); costsDataLocator.setValidationMethodName("validateAccountCode"); costsController.setFrameTitle("accounts"); costsController.setAllowTreeLeafSelectionOnly(false); costsController.setLookupValueObjectClassName( "org.jallinone.accounting.accounts.java.AccountVO"); costsController.addLookup2ParentLink("accountCodeACC02", "costsAccountCodeAcc02PUR01"); costsController.addLookup2ParentLink("descriptionSYS10", "costsAccountDescrPUR01"); costsController.setFramePreferedSize(new Dimension(400, 400)); costsController.setAllColumnVisible(false); costsController.setVisibleColumn("accountCodeACC02", true); costsController.setVisibleColumn("descriptionSYS10", true); costsController.setFilterableColumn("accountCodeACC02", true); costsController.setFilterableColumn("descriptionSYS10", true); costsController.setSortedColumn("accountCodeACC02", "ASC", 1); costsController.setSortableColumn("accountCodeACC02", true); costsController.setSortableColumn("descriptionSYS10", true); costsController.setPreferredWidthColumn("accountCodeACC02", 100); costsController.setPreferredWidthColumn("descriptionSYS10", 290); costsController.addLookupListener( new LookupListener() { public void codeValidated(boolean validated) {} public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) {} public void beforeLookupAction(ValueObject parentVO) { costsDataLocator .getLookupFrameParams() .put(ApplicationConsts.COMPANY_CODE_SYS01, controlCompanyCode.getValue()); costsDataLocator .getLookupValidationParameters() .put(ApplicationConsts.COMPANY_CODE_SYS01, controlCompanyCode.getValue()); } public void forceValidate() {} }); CustomizedControls customizedControls = new CustomizedControls(tabbedPane, supplierPanel, ApplicationConsts.ID_SUPPLIER_GRID); } catch (Exception e) { e.printStackTrace(); } }