public void stateChanged(ChangeEvent e) {
// if (tab.getSelectedIndex()==8) {
if (tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(getItemVariantsPanel())) {
DetailItemVO vo = (DetailItemVO) formPanel.getVOModel().getValueObject();
getItemVariantsPanel().setContent(vo, getVariantsNames());
getItemVariantsPanel().revalidate();
getItemVariantsPanel().repaint();
} // else if (tab.getSelectedIndex()==9) {
else if (tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(getVariantBarcodesPanel())) {
getVariantBarcodesPanel().setItem(formPanel);
getVariantBarcodesPanel().revalidate();
getVariantBarcodesPanel().repaint();
} else if (tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(getVariantMinStockPanel())) {
//else if (tab.getSelectedIndex()==10) {
getVariantMinStockPanel().setItem(formPanel);
getVariantMinStockPanel().revalidate();
getVariantMinStockPanel().repaint();
} else if (customizedControls != null
&& tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(customizedControls)) {
customizedControls.setContent();
customizedControls.revalidate();
customizedControls.repaint();
} else if (tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(discountsPanel)) {
discountsGrid.reloadData();
} else if (tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(pricesSplit)) {
supplierPrices.getPricesGrid().reloadData();
pricesGrid.reloadData();
} else if (tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(docsPanel)) {
docsPanel.getDocsGrid().reloadData();
} else if (tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(bookedItemsPanel)) {
bookedItemsPanel.getGrid().reloadData();
} else if (tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(orderedItemsPanel)) {
orderedItemsPanel.getGrid().reloadData();
} else if (tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(billOfMaterialsPanel)) {
bomTabbedPane.getAltCompsGrid().reloadData();
bomTabbedPane.getComponentsGrid().reloadData();
} else if (tab.getSelectedComponent() != null
&& tab.getSelectedComponent().equals(itemSparePartsPanel)) {
DetailItemVO vo = (DetailItemVO) formPanel.getVOModel().getValueObject();
itemSparePartsPanel.init(vo,false);
}
}
});
discountsGrid.setAutoLoadData(false);
supplierPrices.getPricesGrid().setAutoLoadData(false);
pricesGrid.setAutoLoadData(false);
docsPanel.getDocsGrid().setAutoLoadData(false);
bookedItemsPanel.getGrid().setAutoLoadData(false);
orderedItemsPanel.getGrid().setAutoLoadData(false);
bomTabbedPane.getAltCompsGrid().setAutoLoadData(false);
bomTabbedPane.getComponentsGrid().setAutoLoadData(false);
controlLevel.setLookupController(levelController);
levelController.setLookupDataLocator(levelDataLocator);
levelController.setCodeSelectionWindow(levelController.TREE_FRAME);
levelController.setFrameTitle("hierarchy");
levelController.setAllowTreeLeafSelectionOnly(true);
levelController.getLookupDataLocator().setNodeNameAttribute("descriptionSYS10");
levelController.setLookupValueObjectClassName("org.jallinone.hierarchies.java.CompanyHierarchyLevelVO");
levelController.addLookup2ParentLink("progressiveHIE01", "progressiveHie01ITM01");
levelController.addLookup2ParentLink("descriptionSYS10", "levelDescriptionSYS10");
levelDataLocator.setTreeDataLocator(treeLevelDataLocator);
treeLevelDataLocator.setServerMethodName("loadCompanyHierarchy");
umDataLocator.setGridMethodName("loadMeasures");
umDataLocator.setValidationMethodName("validateMeasureCode");
// u.m. selling qty...
controlUMSellQty.setLookupController(umController);
controlUMSellQty.setControllerMethodName("getMeasureUnitsList");
umController.setLookupDataLocator(umDataLocator);
umController.setFrameTitle("measures");
umController.setLookupValueObjectClassName("org.jallinone.registers.measure.java.MeasureVO");
umController.addLookup2ParentLink("umCodeREG02", "minSellingQtyUmCodeReg02ITM01");
umController.addLookup2ParentLink("decimalsREG02", "minSellingQtyDecimalsREG02");
umController.setAllColumnVisible(false);
umController.setVisibleColumn("umCodeREG02", true);
CustomizedColumns umCust = 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) {
controlMinSellQty.setDecimals(vo.getDecimalsREG02().intValue());
controlMinSellQty.setValue(null);
if (vo.getDecimalsREG02().doubleValue() > 0) {
controlSerialNumRequired.setEnabled(false);
} else if (formPanel.getMode() == Consts.INSERT) {
controlSerialNumRequired.setEnabled(true);
}
} else {
controlSerialNumRequired.setEnabled(false);
}
}
public void beforeLookupAction(ValueObject parentVO) {
}
public void forceValidate() {
}
});
// u.m. gross weight...
controlUMGW.setLookupController(umGWController);
controlUMGW.setControllerMethodName("getMeasureUnitsList");
umGWController.setLookupDataLocator(umDataLocator);
umGWController.setFrameTitle("measures");
umGWController.setLookupValueObjectClassName("org.jallinone.registers.measure.java.MeasureVO");
umGWController.addLookup2ParentLink("umCodeREG02", "grossWeightUmCodeReg02ITM01");
umGWController.addLookup2ParentLink("decimalsREG02", "grossWeightDecimalsREG02");
umGWController.setAllColumnVisible(false);
umGWController.setVisibleColumn("umCodeREG02", true);
CustomizedColumns umGWCust = new CustomizedColumns(ApplicationConsts.ID_UM_GRID, umGWController);
umGWController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {
}
public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) {
MeasureVO vo = (MeasureVO) umGWController.getLookupVO();
if (vo != null && vo.getDecimalsREG02() != null) {
controlGW.setDecimals(vo.getDecimalsREG02().intValue());
}
controlGW.setValue(null);
}
public void beforeLookupAction(ValueObject parentVO) {
}
public void forceValidate() {
}
});
// u.m. net weight...
controlUMNW.setLookupController(umNWController);
controlUMNW.setControllerMethodName("getMeasureUnitsList");
umNWController.setLookupDataLocator(umDataLocator);
umNWController.setFrameTitle("measures");
umNWController.setLookupValueObjectClassName("org.jallinone.registers.measure.java.MeasureVO");
umNWController.addLookup2ParentLink("umCodeREG02", "netWeightUmCodeReg02ITM01");
umNWController.addLookup2ParentLink("decimalsREG02", "netWeightDecimalsREG02");
umNWController.setAllColumnVisible(false);
umNWController.setVisibleColumn("umCodeREG02", true);
CustomizedColumns umNWCust = new CustomizedColumns(ApplicationConsts.ID_UM_GRID, umNWController);
umNWController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {
}
public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) {
MeasureVO vo = (MeasureVO) umNWController.getLookupVO();
controlNW.setDecimals(vo.getDecimalsREG02().intValue());
controlNW.setValue(null);
}
public void beforeLookupAction(ValueObject parentVO) {
}
public void forceValidate() {
}
});
// u.m. width...
controlUMW.setLookupController(umWController);
controlUMW.setControllerMethodName("getMeasureUnitsList");
umWController.setLookupDataLocator(umDataLocator);
umWController.setFrameTitle("measures");
umWController.setLookupValueObjectClassName("org.jallinone.registers.measure.java.MeasureVO");
umWController.addLookup2ParentLink("umCodeREG02", "widthUmCodeReg02ITM01");
umWController.addLookup2ParentLink("decimalsREG02", "widthDecimalsREG02");
umWController.setAllColumnVisible(false);
umWController.setVisibleColumn("umCodeREG02", true);
CustomizedColumns umWCust = new CustomizedColumns(ApplicationConsts.ID_UM_GRID, umWController);
umWController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {
}
public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) {
MeasureVO vo = (MeasureVO) umWController.getLookupVO();
controlW.setDecimals(vo.getDecimalsREG02().intValue());
controlW.setValue(null);
}
public void beforeLookupAction(ValueObject parentVO) {
}
public void forceValidate() {
}
});
// u.m. height...
controlUMH.setLookupController(umHController);
controlUMH.setControllerMethodName("getMeasureUnitsList");
umHController.setLookupDataLocator(umDataLocator);
umHController.setFrameTitle("measures");
umHController.setLookupValueObjectClassName("org.jallinone.registers.measure.java.MeasureVO");
umHController.addLookup2ParentLink("umCodeREG02", "heightUmCodeReg02ITM01");
umHController.addLookup2ParentLink("decimalsREG02", "heightDecimalsREG02");
umHController.setAllColumnVisible(false);
umHController.setVisibleColumn("umCodeREG02", true);
CustomizedColumns umHCust = new CustomizedColumns(ApplicationConsts.ID_UM_GRID, umHController);
umHController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {
}
public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) {
MeasureVO vo = (MeasureVO) umHController.getLookupVO();
controlH.setDecimals(vo.getDecimalsREG02().intValue());
controlH.setValue(null);
}
public void beforeLookupAction(ValueObject parentVO) {
}
public void forceValidate() {
}
});
// lookup vat...
vatDataLocator.setGridMethodName("loadVats");
vatDataLocator.setValidationMethodName("validateVatCode");
controlVat.setLookupController(vatController);
controlVat.setControllerMethodName("getVatsList");
vatController.setLookupDataLocator(vatDataLocator);
vatController.setFrameTitle("vats");
vatController.setLookupValueObjectClassName("org.jallinone.registers.vat.java.VatVO");
vatController.addLookup2ParentLink("vatCodeREG01", "vatCodeReg01ITM01");
vatController.addLookup2ParentLink("descriptionSYS10", "vatDescriptionSYS10");
vatController.addLookup2ParentLink("valueREG01", "vatValueREG01");
vatController.addLookup2ParentLink("deductibleREG01", "vatDeductibleREG01");
vatController.setAllColumnVisible(false);
vatController.setVisibleColumn("vatCodeREG01", true);
vatController.setVisibleColumn("descriptionSYS10", true);
vatController.setVisibleColumn("valueREG01", true);
vatController.setVisibleColumn("deductibleREG01", true);
vatController.setPreferredWidthColumn("descriptionSYS10", 200);
vatController.setFramePreferedSize(new Dimension(510, 400));
CustomizedColumns vatCust = new CustomizedColumns(new BigDecimal(162), vatController);
init();
formPanel.setFormController(controller);
formPanel.addLinkedPanel(imgPanel);
discountsGrid.setController(new DiscountsController(this));
discountsGrid.setGridDataLocator(discountsGridDataLocator);
discountsGridDataLocator.setServerMethodName("loadItemDiscounts");
// currency lookup...
currencyDataLocator.setGridMethodName("loadCurrencies");
currencyDataLocator.setValidationMethodName("validateCurrencyCode");
colCurrencyCode.setLookupController(currencyController);
colCurrencyCode.setControllerMethodName("getCurrenciesList");
currencyController.setLookupDataLocator(currencyDataLocator);
currencyController.setFrameTitle("currencies");
currencyController.setLookupValueObjectClassName("org.jallinone.registers.currency.java.CurrencyVO");
currencyController.addLookup2ParentLink("currencyCodeREG03", "currencyCodeReg03SAL03");
currencyController.setAllColumnVisible(false);
currencyController.setVisibleColumn("currencyCodeREG03", true);
currencyController.setVisibleColumn("currencySymbolREG03", true);
currencyController.setVisibleColumn("decimalsREG03", true);
new CustomizedColumns(new BigDecimal(182), currencyController);
pricesGrid.setController(new PricesController(this));
pricesGrid.setGridDataLocator(pricesGridDataLocator);
pricesGridDataLocator.setServerMethodName("loadPrices");
// pricelist lookup...
pricelistDataLocator.setGridMethodName("loadPricelists");
pricelistDataLocator.setValidationMethodName("validatePricelistCode");
colPricelistCode.setLookupController(pricelistController);
colPricelistCode.setControllerMethodName("getSalePricesList");
pricelistController.setLookupDataLocator(pricelistDataLocator);
pricelistController.setFrameTitle("pricelists");
pricelistController.setLookupValueObjectClassName("org.jallinone.sales.pricelist.java.PricelistVO");
pricelistController.addLookup2ParentLink("pricelistCodeSAL01", "pricelistCodeSal01SAL02");
pricelistController.addLookup2ParentLink("descriptionSYS10", "pricelistDescriptionSYS10");
pricelistController.setAllColumnVisible(false);
pricelistController.setVisibleColumn("pricelistCodeSAL01", true);
pricelistController.setVisibleColumn("descriptionSYS10", true);
new CustomizedColumns(new BigDecimal(302), pricelistController);
pricelistController.addLookupListener(new LookupListener() {
public void codeValidated(boolean validated) {
}
public void codeChanged(ValueObject parentVO, Collection parentChangedAttributes) {
}
public void beforeLookupAction(ValueObject parentVO) {
DetailItemVO itemVO = (DetailItemVO) getFormPanel().getVOModel().getValueObject();
pricelistDataLocator.getLookupFrameParams().put(ApplicationConsts.COMPANY_CODE_SYS01, itemVO.getCompanyCodeSys01ITM01());
pricelistDataLocator.getLookupValidationParameters().put(ApplicationConsts.COMPANY_CODE_SYS01, itemVO.getCompanyCodeSys01ITM01());
}
public void forceValidate() {
}
});