Simple question: I have a CellTable filled with Keyword objects. Now, I would like to retrieve all the Keywords in that CellTable. Is this possible? If not, why? Surely there must be a way...
I can not understand how this is so hard (well maybe it isn't but I just can't seem find the answer for the life of me).
Some code to clarify:
//my celltable
private CellTable<Keyword> ctKeywordsLinked = new CellTable<Keyword>();
//listdataprovider to fill my celltable with
private ListDataProvider<Keyword> dataProviderLinkedKeywords = new ListDataProvider<Keyword>();
//add 4 keyword objects to the listdataprovider to fill the celltable
dataProviderLinkedKeywords.getList().add(new Keyword);
dataProviderLinkedKeywords.getList().add(new Keyword);
dataProviderLinkedKeywords.getList().add(new Keyword);
dataProviderLinkedKeywords.getList().add(new Keyword);
So now that I have my celltable filled, I would like to retrieve those 4 keywords without touching the listdataprovider. I hope everything is a bit more cleared up :-)
CellTable
has method getKeyProvider
, which returns object containing data under ProvidesKey
interface.
You create ListDataProvider and pass it to cell table, so you can get that provider from cell table again at any time:
ListDataProvider provider = (ListDataProvider)cellTable.getKeyProvider();
provider.getList().get(0); // get first Keyword