Friday, August 23, 2013

CellTable of Strings

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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment