private void jbInit() throws Exception { hierarTreePanel.setEnabled(false); warehousePanel.setLayout(borderLayout1); warehouseForm.setVOClassName("org.jallinone.warehouse.java.WarehouseVO"); this.setTitle(ClientSettings.getInstance().getResources().getResource("warehouse detail")); buttonsPanel.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.LEFT); insertButton.setText("insertButton1"); reloadButton.setText("reloadButton1"); deleteButton.setText("deleteButton1"); warehouseForm.setInsertButton(insertButton); warehouseForm.setCopyButton(copyButton); warehouseForm.setEditButton(editButton); warehouseForm.setReloadButton(reloadButton); warehouseForm.setDeleteButton(deleteButton); warehouseForm.setSaveButton(saveButton); warehouseForm.setFunctionId("WAR01"); warehouseForm.setLayout(gridBagLayout1); controlZip.setAttributeName("zipWAR01"); controlZip.setCanCopy(true); controlZip.setLinkLabel(labelZip); controlZip.setMaxCharacters(20); controlProv.setAttributeName("provinceWAR01"); controlProv.setCanCopy(true); controlProv.setLinkLabel(labelProv); controlProv.setMaxCharacters(20); controlProv.setTrimText(true); controlProv.setUpperCase(true); controlCity.setAttributeName("cityWAR01"); controlCity.setCanCopy(true); controlCity.setLinkLabel(labelCity); controlAddress.setAttributeName("addressWAR01"); controlAddress.setCanCopy(true); controlAddress.setLinkLabel(labelAddress); labelAddress.setText("address"); controlCountry.setAttributeName("countryWAR01"); controlCountry.setCanCopy(true); controlCountry.setLinkLabel(labelCountry); controlCountry.setMaxCharacters(20); controlCountry.setTrimText(true); controlCountry.setUpperCase(true); labelZip.setText("zip"); labelCity.setText("city"); labelCountry.setText("country"); labelProv.setText("prov"); controlWarCode.setAttributeName("warehouseCodeWAR01"); controlWarCode.setLinkLabel(labelWarCode); controlWarCode.setMaxCharacters(20); controlWarCode.setRequired(true); controlWarCode.setRpadding(false); controlWarCode.setTrimText(true); controlWarCode.setUpperCase(true); controlWarCode.setEnabledOnEdit(false); labelWarCode.setText("warehouseCodeWAR01"); labelDescr.setText("descriptionWAR01"); controlDescr.setAttributeName("descriptionWAR01"); controlDescr.setLinkLabel(labelDescr); controlDescr.setRequired(true); labelCompanyCode.setText("companyCodeSys01WAR01"); controlCompaniesCombo.setAttributeName("companyCodeSys01WAR01"); controlCompaniesCombo.setCanCopy(true); controlCompaniesCombo.setLinkLabel(labelCompanyCode); controlCompaniesCombo.setRequired(true); controlCompaniesCombo.setEnabledOnEdit(false); labelRoles.setText("edit/delete warehouse role"); controlRoles.setAttributeName("progressiveSys04WAR01"); controlRoles.setDomainId("USERROLES"); controlRoles.setLinkLabel(labelRoles); locationsPanel.setLayout(borderLayout2); tabbedPane.add(warehousePanel, "warehousePanel"); this.getContentPane().add(buttonsPanel, BorderLayout.NORTH); this.getContentPane().add(tabbedPane, BorderLayout.CENTER); warehouseForm.add( labelZip, new GridBagConstraints( 3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelCity, new GridBagConstraints( 0, 4, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelAddress, new GridBagConstraints( 0, 3, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlAddress, new GridBagConstraints( 2, 3, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlCity, new GridBagConstraints( 2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0)); warehouseForm.add( controlZip, new GridBagConstraints( 4, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlWarCode, new GridBagConstraints( 2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0)); warehousePanel.add(warehouseForm, BorderLayout.CENTER); buttonsPanel.add(insertButton, null); buttonsPanel.add(copyButton, null); buttonsPanel.add(editButton, null); buttonsPanel.add(saveButton, null); buttonsPanel.add(reloadButton, null); buttonsPanel.add(deleteButton, null); buttonsPanel.add(navigatorBar, null); warehouseForm.add( labelWarCode, new GridBagConstraints( 0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); warehouseForm.add( labelDescr, new GridBagConstraints( 0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlDescr, new GridBagConstraints( 2, 2, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlCountry, new GridBagConstraints( 4, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelCountry, new GridBagConstraints( 3, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelProv, new GridBagConstraints( 0, 5, 1, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0)); warehouseForm.add( controlProv, new GridBagConstraints( 2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelCompanyCode, new GridBagConstraints( 0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); tabbedPane.add(locationsPanel, "locationsPanel"); locationsPanel.add(split, BorderLayout.CENTER); split.setDividerLocation(150); split.add(hierarTreePanel, JSplitPane.LEFT); split.add(availPanel, JSplitPane.RIGHT); tabbedPane.add(bookedItemsPanel, "bookedItemsPanel"); tabbedPane.add(orderedItemsPanel, "orderedItemsPanel"); hierarTreePanel.setFunctionId("WAR01"); tabbedPane.setTitleAt( 0, ClientSettings.getInstance().getResources().getResource("warehouse detail")); tabbedPane.setTitleAt(1, ClientSettings.getInstance().getResources().getResource("positions")); tabbedPane.setTitleAt( 2, ClientSettings.getInstance().getResources().getResource("bookedItemsPanel")); tabbedPane.setTitleAt( 3, ClientSettings.getInstance().getResources().getResource("orderedItemsPanel")); warehouseForm.add( controlCompaniesCombo, new GridBagConstraints( 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlRoles, new GridBagConstraints( 2, 6, 1, 2, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelRoles, new GridBagConstraints( 0, 7, 2, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); }
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(); } }