private List transSplitList = null;
public Object getValueAt(int row, int col) {
trans = (RegisterTrans)transactionList.get(row);
transSplitList = trans.getTransSplitList();
TransSplit transSplit = null;
if (col == 0)
return GUIConstants.DATE_FORMAT.format(trans.getDatePosted().getTime());
else if (col == 1) {
String accountStr = "";
for (int i=0; i<transSplitList.size(); i++) {
transSplit = (TransSplit)transSplitList.get(i);
if (transSplit.getAmount().doubleValue() >= 0) {
if (accountStr.length() == 0)
accountStr += transSplit.getAccount().getTitle();
else
accountStr += ", " + transSplit.getAccount().getTitle();
}
}
return accountStr;
}
else if (col == 2) {
String accountStr = "";
for (int i=0; i<transSplitList.size(); i++) {
transSplit = (TransSplit)transSplitList.get(i);
if (transSplit.getAmount().doubleValue() < 0) {
if (accountStr.length() == 0)
accountStr += transSplit.getAccount().getTitle();
else
accountStr += ", " + transSplit.getAccount().getTitle();
}
}
return accountStr;
}
else if (col == 3) {
double amount = 0;
for (int i=0; i<transSplitList.size(); i++) {
transSplit = (TransSplit)transSplitList.get(i);
if (transSplit.getAmount().doubleValue() >= 0) {
amount += transSplit.getAmount().doubleValue();
}
}
return GUIConstants.CURRENCY_FORMAT.format(amount);
}
else