private void init() {
grid.setAutoLoadData(false);
controlCompaniesCombo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Object companyCodeSys01 = controlCompaniesCombo.getValue();
if (companyCodeSys01==null)
companyCodeSys01 = controlCompaniesCombo.getDomain().getDomainPairList()[0].getCode();
grid.getOtherGridParams().put(ApplicationConsts.COMPANY_CODE_SYS01,companyCodeSys01);
Response res = ClientUtils.getData("loadVariantsNames",companyCodeSys01);
if (!res.isError()) {
variantsNames.clear();
java.util.List list = ( (VOListResponse) res).getRows();
VariantNameVO vo = null;
Domain d = new Domain("DOMAIN_VARIANTS");
for(int i=0;i<list.size();i++) {
vo = (VariantNameVO)list.get(i);
if (!vo.getDescriptionSYS10().equals(ApplicationConsts.JOLLY)) {
d.addDomainPair(vo.getTableName(), vo.getDescriptionSYS10());
variantsNames.put(vo.getTableName(),vo);
}
}
varNameComboBoxControl.setDomain(d);
if (d.getDomainPairList().length>0)
varNameComboBoxControl.setSelectedIndex(0);
}
}
});
varNameComboBoxControl.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange()==e.SELECTED) {
grid.getOtherGridParams().put(ApplicationConsts.TABLE_NAME,varNameComboBoxControl.getValue());
VariantNameVO vo = (VariantNameVO)variantsNames.get(varNameComboBoxControl.getValue());
Domain d = new Domain("DOMAIN_VARIANT_TYPES");
if (vo.getUseVariantTypeITM21().booleanValue()) {
filterPanel.remove(varTypesLabel);
filterPanel.remove(varTypesComboBoxControl);
filterPanel.add(varTypesLabel, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
filterPanel.add(varTypesComboBoxControl, new GridBagConstraints(5, 0, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
// retrieve variant types...
Object companyCodeSys01 = controlCompaniesCombo.getValue();
if (companyCodeSys01==null)
companyCodeSys01 = controlCompaniesCombo.getDomain().getDomainPairList()[0].getCode();
GridParams gridParams = new GridParams();
gridParams.getOtherGridParams().put(ApplicationConsts.COMPANY_CODE_SYS01,companyCodeSys01);
gridParams.getOtherGridParams().put(ApplicationConsts.TABLE_NAME,varNameComboBoxControl.getValue());
Response res = ClientUtils.getData("loadVariantTypes",gridParams);
if (!res.isError()) {
java.util.List list = ( (VOListResponse) res).getRows();
VariantTypeVO vtVO = null;
for(int i=0;i<list.size();i++) {
vtVO = (VariantTypeVO)list.get(i);
d.addDomainPair(vtVO.getVariantType(),vtVO.getDescriptionSys10());
}
}
}
else {
filterPanel.remove(varTypesLabel);
filterPanel.remove(varTypesComboBoxControl);
}
varTypesComboBoxControl.setDomain(d);
if (d.getDomainPairList().length>0)
varTypesComboBoxControl.setSelectedIndex(0);
filterPanel.revalidate();
filterPanel.repaint();
grid.getOtherGridParams().put(ApplicationConsts.VARIANT_TYPE,varTypesComboBoxControl.getValue());
grid.reloadData();
}
}
});
varTypesComboBoxControl.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange()==e.SELECTED) {
grid.getOtherGridParams().put(ApplicationConsts.VARIANT_TYPE,varTypesComboBoxControl.getValue());
grid.reloadData();