JOptionPane.WARNING_MESSAGE
);
return;
}
tableVO = (TableVO)((VOResponse)res).getVo();
ColumnVO colVO = null;
CustomColumnVO customColVO = null;
boolean found;
Hashtable whereParamColNames = new Hashtable(); // collection of <columnname,index in where> related to where params...
boolean paramsRequired = false; // flag used to disable auto data loading...
ArrayList paramsDefined = new ArrayList(); // input controls defined in filter panel; used to auto set filter panel height into the split pane...
int count = 0;
for(int i=0;i<customCols.size();i++) {
customColVO = (CustomColumnVO)customCols.get(i);
found = false;
for(int j=0;j<tableVO.getColumns().size();j++) {
colVO = (ColumnVO)tableVO.getColumns().get(j);
if (customColVO.getColumnNameSYS22().equals(colVO.getColumnName())) {
found = true;
break;
}
}
if (!found && customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_WHERE)) {
// parameter in where clause...
colVO = new ColumnVO(tableVO);
colVO.setColumnName(customColVO.getColumnNameSYS22());
colVO.setAttributeName(customColVO.getColumnNameSYS22());
colVO.setColumnHeaderName(customColVO.getColumnNameSYS22());
colVO.setColumnType(ApplicationConsts.TYPE_TEXT);
colVO.setColumnSize(new BigDecimal(255));
whereParamColNames.put(colVO.getAttributeName(),new Integer(count));
whereParamsFilled.put(new Integer(count),new Boolean(false));
count++;
found = true;
}
if (!found)
continue;
if (customColVO.isIsParamRequiredSYS22())
paramsRequired = true;
if (customColVO.isIsParamSYS22()) {
if (paramsDefined.size()==0) {
// add filter panel title...
TitledBorder titledBorder1 = new TitledBorder(ClientSettings.getInstance().getResources().getResource("filter conditions"));
titledBorder1.setTitleColor(Color.blue);
filterPanel.setBorder(titledBorder1);
}
// define label + input control for filter panel...
LabelControl label = new LabelControl();
label.setText(colVO.getColumnHeaderName());
InputControl inputControl = null;
if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_TEXT) ||
customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_WHERE)) {
inputControl = new TextControl();
inputControl.setAttributeName(colVO.getAttributeName());
if (colVO.getColumnSize().intValue()>10)
((TextControl)inputControl).setColumns(Math.min(30,colVO.getColumnSize().intValue()));
((TextControl)inputControl).setRequired(customColVO.isIsParamRequiredSYS22());
((TextControl)inputControl).setValue(customColVO.getDefaultValueTextSYS22());
((TextControl)inputControl).setMaxCharacters(colVO.getColumnSize().intValue());
}
else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_NUM)) {
inputControl = new NumericControl();
inputControl.setAttributeName(colVO.getAttributeName());
if (colVO.getColumnSize().intValue()>10)
((NumericControl)inputControl).setColumns(Math.min(30,colVO.getColumnSize().intValue()));
((NumericControl)inputControl).setRequired(customColVO.isIsParamRequiredSYS22());
((NumericControl)inputControl).setValue(customColVO.getDefaultValueNumSYS22());
((NumericControl)inputControl).setMaxValue(Math.pow(10d,colVO.getColumnSize().doubleValue()));
if (colVO.getColumnDec()!=null)
((NumericControl)inputControl).setDecimals(colVO.getColumnDec().intValue());
}
else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_DATE)) {
inputControl = new DateControl();
inputControl.setAttributeName(colVO.getAttributeName());
((DateControl)inputControl).setRequired(customColVO.isIsParamRequiredSYS22());
((DateControl)inputControl).setValue(customColVO.getDefaultValueNumSYS22());
if (customColVO.getDefaultValueDateSYS22()!=null &&
customColVO.getDefaultValueDateSYS22().equals(Boolean.TRUE))
((DateControl)inputControl).setValue(new java.sql.Date(System.currentTimeMillis()));
}
else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_ENUM) &&
customColVO.getConstraintValuesSYS22()!=null &&
customColVO.getConstraintValuesSYS22().length()>0) {
inputControl = new ComboBoxControl();
inputControl.setAttributeName(colVO.getAttributeName());
((ComboBoxControl)inputControl).setRequired(customColVO.isIsParamRequiredSYS22());
((ComboBoxControl)inputControl).setValue(customColVO.getDefaultValueNumSYS22());
ArrayList domainValues = new ArrayList();
StringTokenizer stt = new StringTokenizer(customColVO.getConstraintValuesSYS22(),",");
String token = null;
Domain domain = new Domain(colVO.getColumnName());
while(stt.hasMoreTokens()) {
token = stt.nextToken();
domain.addDomainPair(token,token);
}
((ComboBoxControl)inputControl).setDomain(domain);
}
// add label + input control to filter panel...
filterPanel.add(label, new GridBagConstraints(0, paramsDefined.size(), 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
filterPanel.add((JComponent)inputControl, new GridBagConstraints(1, paramsDefined.size(), 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
paramsDefined.add(inputControl);
}
colVO.setColumnVisible(customColVO.isColumnVisibleSYS22());
if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_PROG)) {
colVO.setProgressive(true);
colVO.setColumnRequired(false);
}
if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_TEXT))
colVO.setDefaultValue(customColVO.getDefaultValueTextSYS22());
else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_NUM))
colVO.setDefaultValue(customColVO.getDefaultValueNumSYS22());
else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_DATE) &&
customColVO.getDefaultValueDateSYS22()!=null &&
customColVO.getDefaultValueDateSYS22().equals(Boolean.TRUE))
colVO.setDefaultValue(new java.sql.Date(System.currentTimeMillis()));
else if (customColVO.getColumnTypeSYS22().equals(ApplicationConsts.TYPE_ENUM) &&
customColVO.getConstraintValuesSYS22()!=null &&
customColVO.getConstraintValuesSYS22().length()>0) {
ArrayList domainValues = new ArrayList();
StringTokenizer stt = new StringTokenizer(customColVO.getConstraintValuesSYS22(),",");
while(stt.hasMoreTokens())
domainValues.add(stt.nextToken());
colVO.setColumnValues(domainValues);
}
}
// create grid panel...