Reputation: 2688
I'd like to determine whether an icon is used based on the value of the "row" value that is in the CellTable (or DataGrid). How do I determine that when building the Cell renderer?
IconCellDecorator<String> icd = new IconCellDecorator<String>(res.search(), new ClickableTextCell()) {
@Override
protected boolean isIconUsed(String value) {
//value may not be unique across rows (column value), I really need the row instance here.
}
};
Upvotes: 0
Views: 611
Reputation: 2688
I decided to rewrite IconCellDecorator so that the getImageUsed method passes in the Context object, which gives me the row index and key. This seemed the most straightforward for specifically what I was trying to accomplish, although Thomas' answer should work as well.
Upvotes: 0
Reputation: 64561
If you need the row object, you'll have to use an IconCellDecorator<RowObject>
, and wrap or subclass the ClickableTextCell
to extract the String
out of the RowObject
.
Or you could use a CompositeCell
and ImageResourceCell
instead of the IconCellDecorator
.
Upvotes: 1