/** Retrieve item types and fill in the item types combo box. */ private void init() { Response res = ClientUtils.getData("loadItemTypes", new GridParams()); Domain d = new Domain("ITEM_TYPES"); if (!res.isError()) { ItemTypeVO vo = null; list = ((VOListResponse) res).getRows(); for (int i = 0; i < list.size(); i++) { vo = (ItemTypeVO) list.get(i); d.addDomainPair(vo.getProgressiveHie02ITM02(), vo.getDescriptionSYS10()); } } controlHierarchy.setDomain(d); controlHierarchy .getComboBox() .addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == e.SELECTED) { ItemTypeVO typeVO = (ItemTypeVO) list.get(controlHierarchy.getSelectedIndex()); treePanel.setCompanyCode(typeVO.getCompanyCodeSys01ITM02()); treePanel.setProgressiveHIE02((BigDecimal) controlHierarchy.getValue()); DetailSupplierVO vo = (DetailSupplierVO) supplierPanel.getVOModel().getValueObject(); treePanel.setCompanyCode(vo.getCompanyCodeSys01REG04()); treePanel.reloadTree(); itemsGrid.clearData(); } } }); if (d.getDomainPairList().length == 1) controlHierarchy.getComboBox().setSelectedIndex(0); else controlHierarchy.getComboBox().setSelectedIndex(-1); }
/** * Method invoked when pressing import all items button: it add all items to the supplier items * collection. */ void impAllItemsButton_actionPerformed(ActionEvent e) { DetailSupplierVO vo = (DetailSupplierVO) supplierPanel.getVOModel().getValueObject(); SupplierItemVO itemVO = new SupplierItemVO(); itemVO.setCompanyCodeSys01PUR02(vo.getCompanyCodeSys01REG04()); itemVO.setProgressiveReg04PUR02(vo.getProgressiveREG04()); itemVO.setProgressiveHie02PUR02((BigDecimal) controlHierarchy.getValue()); Response res = ClientUtils.getData("importAllItemsToSupplier", itemVO); if (!res.isError()) itemsGrid.reloadData(); }