Binding Pojo to table

Hi

I have a Pojo Class and want to bind it to a table. The class has 3 values: id, amount, incomeExpenses. The class is used to calculate the income and expenses for a company.

pojo.amount
holds the sum of money

pojo.incomeExpense
is used to find out wether the money is income or expense.

The table should have 3 colums: id, income, expenses

So far i used a indexedContainer and filled it manually like this:


			// first find out wether it is income or expense
			if (pojo.getIncomeExpense().equals(0)) { 
				container.addItem(new Object[] {
						pojo.getId(),  pojo.getAmount(), 0.0
				});
				sumIncome += pojo.getAmount();
			} else {
				container.addItem(new Object[] {
						pojo.getId(),  0.0,pojo.getAmount()
				});
				sumExpenses += pojo.getAmount();
			}

Is there a way to bind my pojo to the table and just add the 2 extra colums?

Cheers Rolfe

Use BeanItemContainer to bind your POJO to the table. The displayed Columns can be defined via Table#setVisibleColumns().