SelectionCell and CellTable

411 views
Skip to first unread message

Ed M

unread,
Oct 11, 2010, 4:20:43 PM10/11/10
to Google Web Toolkit
After reviewing the updated GWT CellTable showcase code samples, I
found myself stuck with something I hope is relatively easy for more
experienced folks out there. the following is a snippet from the
showcase which is at the heart of the issue.

final Category[] categories = ContactDatabase.get().queryCategories();
List<String> categoryNames = new ArrayList<String>();
for (Category category : categories) {
categoryNames.add(category.getDisplayName());
}
SelectionCell categoryCell = new SelectionCell(categoryNames);
Column<ContactInfo, String> categoryColumn = new Column<
ContactInfo, String>(categoryCell) {
@Override
public String getValue(ContactInfo object) {
return object.getCategory().getDisplayName();
}
};
cellTable.addColumn(categoryColumn,
constants.cwCellTableColumnCategory());

The showcase example is based on the assumption that all rows must
have the same selection menu options (ie: CategoryNames are identical
for all objects in the table)

Unfortunately what I am currently working on requires that each
object in the cellTable may have it's own menu list. Can anyone
provide any clues as to how I would go about modifying the previous
code so that each object/row would have it's own SelectionCell?

I currently looking at the posibility of creating a custom
'CustomSelectionCell(ProvidesKey keyProvider) {} that will allow me to
directly access the target row/object. but I am unclear as to how to
accomplish this.

Thanks.

Reply all
Reply to author
Forward
0 new messages