A org.uqbar.arena.widgets.tables.Table[R] shows a table / grid with a list of elements of type R.
A table must
A Table that shows a collection of customers in a Cell Phone company:
// Xtend val table = new Table<Customer>(mainPanel, typeof(Customer)) => [ items <=> "results" value <=> "selectedCustomer" ] // Java Table<Customer> table = new Table<Celular>(mainPanel, Customer.class); table.bindItemsToProperty("results"); table.bindValueToProperty("selectedCustomer");
Note the parallel relation between Table and Column models: the table has a customer list as a model, whereas every column has a customer as a model.
And this is how we add a column with the name of every customer:
// Xtend new Column<Customer>(table) => [ title = "Name" fixedSize = 200 bindContentsToProperty("fullName") ] // Java new Column<Celular>(table) // .setTitle("Name") .setFixedSize(250) .bindContentsToProperty("fullName");
A Customer has a String property fullName.
You can align a column by using alignLeft() -default-, alignCenter() or alignRight() messages.
// Xtend new Column<Customer>(table) => [ title = "Amount" alignRight bindContentsToProperty("amount") ] // Java new Column<Celular>(table) // .setTitle("Amount") .alignRight() .bindContentsToProperty("amount");
If you want to adapt a property you can