Yes, create an object that will have column1, etc as attributes, then
create a List<Word> and populate it with your source list however you want
to (preferably you might want to send this list like your CellTable will
use already populated from the server):
public class Word {
String column1;
String column2;
String column3;
String column4;
// add setters and getters
}
List<Word> wordList = new ArrayList<Word>(); // or whatever List
implementation you like/need
// populate wordList as needed from your source list(s) and add it to your
ListDataProvider.
// Create column1
TextColumn<Word> columnOne = new TextColumn<Word>() {
@Override public String getValue(Word word) { return word.getColumn1;
} };
On Friday, August 23, 2013 2:24:58 PM UTC-4, Noel Reforma wrote:
>
> Hello. I'm trying to build a table (20 rows x 4 columns) of just Strings.
> I'm using a CellTable and use the ListDataProvider but since my datasource
> is just a List<String>, I'm having trouble trying to figure out how to
> split my list so that it will put 20 per column. Initially, I'm thinking
> about just creating an object that will have column1, column2, column3 and
> column4 as attributes but I'm not sure if this is the best way to do it.
>
> public Word {
>
> List<String> column1;
> List<String> column2;
> List<String> column3;
> List<String> column4;
> }
>
> I guess this is more of a design question. i'm just looking for a cleaner
> way of doing it. Since I can't do the following because I just have a
> List<String>, I how can I distinguish the set that will go to col1 and
> col2...etc.
>
> // Create address column.
> TextColumn<Contact> addressColumn = new TextColumn<Contact>() {
> @Override
> public String getValue(Contact contact) {
> return contact.address; // I cannot do something like
> this...should I use an Array so I can point to the next column?
> }
> };
>
>
> Thanks. Any advice is appreciated.
>
> NR
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.