Iterator componentExtIter = componentExts.iterator();
while (componentExtIter.hasNext()) {
ComponentExt componentExt = (ComponentExt)componentExtIter.next();
Column column = componentExt.getColumn();
JComponent component = componentExt.getComponent();
switch (column.getInputType()) {
case 1:
case 2:
if ( (column.getPControls() == null) || (column.getPControls().equals("")) ) {
DAO dao = DAO.getInstance();
dao.query(column.getInputPar());
ResultSet rs = dao.executeQuery();
try {
//add null
Item nilItem = new Item("", "");
((JComboBox)component).addItem(nilItem);
ResultSetMetaData rsmd = rs.getMetaData();
if (rsmd.getColumnCount() == 1) {
while (rs.next()) {
Item item = new Item(rs.getObject(1), rs.getObject(1));
((JComboBox)component).addItem(item);
}
} else {
while (rs.next()) {
Object value = null;
StringBuffer sb = new StringBuffer();
sb.append("<html>");
for (int i = 1; i < rsmd.getColumnCount(); i++) {
if (rsmd.getColumnName(i).equals(column.getColumnName())) {
sb.append("<b>" + rs.getObject(i) + "</b> | ");
value = rs.getObject(i);
} else {
sb.append(rs.getObject(i) + " | ");
}
}
if (rsmd.getColumnName(rsmd.getColumnCount()).equals(column.getColumnName())) {
sb.append("<b>" + rs.getObject(rsmd.getColumnCount()) + "</b>");
value = rs.getObject(rsmd.getColumnCount());
} else {
sb.append(rs.getObject(rsmd.getColumnCount()) + "");
}
sb.append("</html>");
Item item = new Item(value, sb.toString());
((JComboBox)component).addItem(item);
}
}
rs.close();
}
catch (SQLException sqle) {
}
}
break;
case 81:
case 82:
if ( (column.getPControls() == null) || (column.getPControls().equals("")) ) {
DAO dao = DAO.getInstance();
dao.query(column.getInputPar());
ResultSet rs = dao.executeQuery();
try {
ResultSetMetaData rsmd = rs.getMetaData();
Vector columnNames = new Vector();
Vector datas = new Vector();
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
columnNames.add(ObjectUtil.findColumnTxt(column.getClsId(), column.getTableName(), rsmd.getColumnName(i)));
}
columnNames.add("value");//restore value
while (rs.next()) {
Vector rowDatas = new Vector();
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
Object columnValue = rs.getObject(rsmd.getColumnName(i));
if (column.isI18N()) {
String i18nString = I18NManager.getI18NString(column.getI18nPrefix(), columnValue);
rowDatas.add(i18nString + "(" + columnValue + ")");
} else {
rowDatas.add(columnValue);
}
}
rowDatas.add(rs.getObject(column.getColumnName()));//value
datas.add(rowDatas);
}
ListTableModel model = new ListTableModel(columnNames, datas);
((DetailList)component).updateTable(model);
} catch (Exception e) {
e.printStackTrace();
}
}
break;
case 87:
if (column.getInputPar().indexOf("[") == -1) {
DAO dao = DAO.getInstance();
dao.query(column.getInputPar());
ResultSet rs = dao.executeQuery();
try {
ResultSetMetaData rsmd = rs.getMetaData();
Vector columnNames = new Vector();
Vector datas = new Vector();
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
columnNames.add(ObjectUtil.findColumnTxt(column.getClsId(), column.getTableName(), rsmd.getColumnName(i)));
}
columnNames.add("value");//restore value
while (rs.next()) {
Vector rowDatas = new Vector();
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
Object columnValue = rs.getObject(rsmd.getColumnName(i));
if (column.isI18N()) {
String i18nString = I18NManager.getI18NString(column.getI18nPrefix(), columnValue);
rowDatas.add(i18nString + "(" + columnValue + ")");
} else {
rowDatas.add(columnValue);
}
}
rowDatas.add(rs.getObject(column.getColumnName()));//value
datas.add(rowDatas);
}
ListTableModel model = new ListTableModel(columnNames, datas);
((DetailList)component).updateTable(model);
} catch (Exception e) {
e.printStackTrace();
}
}
break;
case 7:
if (column.getInputPar().indexOf("[") == -1) {
DAO dao = DAO.getInstance();
dao.query(column.getInputPar());
ResultSet rs = dao.executeQuery();
try {
while (rs.next()) {
ResultSetMetaData rsmd = rs.getMetaData();
Object value = null;
String displayValue = "";
displayValue += "<html>";
for (int i = 1; i < rsmd.getColumnCount(); i++) {
if (rsmd.getColumnName(i).equals(column.getColumnName())) {
displayValue += "<i><b>";
displayValue += rs.getObject(i);
displayValue += "</i></b> ";
value = rs.getObject(i);
} else {
displayValue += rs.getObject(i);
displayValue += " ";
}
}
if (rsmd.getColumnName(rsmd.getColumnCount()).equals(column.getColumnName())) {
displayValue += "<i><b>";
displayValue += rs.getObject(rsmd.getColumnCount());
displayValue += "</i></b> ";
value = rs.getObject(rsmd.getColumnCount());
} else {