accountNum.setText(String.valueOf(user.accountNum));
balance.setText(formatAmount(user.balance) + " CapraCoins");
if (user.transactions != null) {
DateTimeFormat dateFormat = DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_SHORT);
transactionsGrid.resizeRows(user.transactions.size() + 1);
RowFormatter rowFormatter = transactionsGrid.getRowFormatter();
int row = 1;
for (BankTransaction transaction : user.transactions) {
boolean isOutgoing = transaction.fromAccount == user.accountNum;
transactionsGrid.setText(row, 0, String.valueOf(transaction.transactionId));
transactionsGrid.setText(row, 1, dateFormat.format(transaction.timestamp));
transactionsGrid.setText(row, 2, formatAccountNum(transaction.fromAccount, user));
transactionsGrid.setText(row, 3, formatAccountNum(transaction.toAccount, user));
transactionsGrid.setText(row, 4, (isOutgoing ? "- " : "+ ") + formatAmount(transaction.amount));
transactionsGrid.setText(row, 5, transaction.comment);
rowFormatter.addStyleName(row, isOutgoing ? "transactionsTableOutgoingTransactionRow" : "transactionsTableIncomingTransactionRow");
row++;
}
}
CellFormatter cellFormatter = transactionsGrid.getCellFormatter();
for (int row = 0; row < transactionsGrid.getRowCount(); row++) {