ItemTableModel model = (ItemTableModel)container.getTable().getModel();
Vector dataVector = model.getDataVector();
Iterator rowDatasIter = dataVector.iterator();
while (rowDatasIter.hasNext()) {
Vector rowDatas = (Vector)rowDatasIter.next();
Row childRow = (Row)rowDatas.get(rowDatas.size() - 1);
Iterator pkColumnIter = container.getObject().getPkColumns().iterator();
String mainTableName = container.getObject().getMainTableName();
String childTableName = container.getObject().getChildTableName();
while (pkColumnIter.hasNext()) {
Column pkColumn = (Column)pkColumnIter.next();
if (pkColumn.getTableName().equals(mainTableName)) {
Cell childPkOldCell = ObjectUtil.findOldCell(childRow, childTableName, pkColumn.getColumnName());
//found
if (childPkOldCell != null) {
Cell childPkNewCell = ObjectUtil.findNewCell(childRow, childTableName, pkColumn.getColumnName());
Cell mainPkNewCell = ObjectUtil.findNewCell(container.getCurrentRow(), mainTableName, pkColumn.getColumnName());
childPkOldCell.setColumnValue(mainPkNewCell.getColumnValue());
childPkNewCell.setColumnValue(mainPkNewCell.getColumnValue());
}
}
}
childRow.setModify(true);
childRow.print();
}
//set childs' components
rowDatasIter = dataVector.iterator();
while (rowDatasIter.hasNext()) {
Vector rowDatas = (Vector)rowDatasIter.next();
Row childRow = (Row)rowDatas.get(rowDatas.size() - 1);
Vector itemComponentExts = container.getItemComponentExts();
Iterator itemComponentExtIter = itemComponentExts.iterator();
while (itemComponentExtIter.hasNext()) {
ComponentExt componentExt = (ComponentExt)itemComponentExtIter.next();
Column column = componentExt.getColumn();
JComponent component = ComponentManager.getComponent(componentExt.getColumn());
componentExt.setComponent(component);
}
container.setItemComponentExts(itemComponentExts);
container.createRelation();
itemComponentExtIter = itemComponentExts.iterator();
while (itemComponentExtIter.hasNext()) {
ComponentExt componentExt = (ComponentExt)itemComponentExtIter.next();
Column column = componentExt.getColumn();
container.getRelationManager().init81Or82Or83ComponentAction(componentExt);
ComponentManager.setValue(getValue(componentExt.getColumn(), childRow), componentExt.getComponent());
}
itemComponentExtIter = itemComponentExts.iterator();
while (itemComponentExtIter.hasNext()) {
ComponentExt componentExt = (ComponentExt)itemComponentExtIter.next();
if (componentExt.getComponent() instanceof DetailList) {
// System.err.println("dldldl");
DetailList dl = (DetailList)componentExt.getComponent();
dl.getNotVisibleTableButton().doClick();
}
}
Iterator componentExtIter = itemComponentExts.iterator();
while (componentExtIter.hasNext()) {
ComponentExt componentExt = (ComponentExt)componentExtIter.next();
JComponent component = componentExt.getComponent();
Column column = componentExt.getColumn();
if (column.isMandatory()) {
if ( (ComponentManager.getValue(component) == null) || (ComponentManager.getValue(component).toString().trim().equals("")) ) {
result = false;
}
}
}
if (result) {
setItemCellValue(childRow);
if (childRow.isAdd()) {
result = container.getObject().classInsert_Child(childRow, true);
} else if (childRow.isModify()) {
result = container.getObject().classUpdate_Child(childRow, true);
}
}
if (result) {
result = validate81Components_child(itemComponentExts, childRow);