I'm using the ListDataProvider. I can write code like:
public class MyListPanel extends VerticalPanel {
private TextCell textCell = new TextCell();
private CellList<String> cellList = new CellList<String>(textCell);
private ListDataProvider<String> dataProvider = new
ListDataProvider<String>();
private void createUI() {
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.setSize("100%", "5em");
dataProvider.addDataDisplay(cellList);
scrollPanel.setWidget(cellList);
add(scrollPanel);
}
public List<String> getList() {
return dataProvider.getList();
}
public addToList(String item) {
System.out.println("addToList: item=" + item);
dataProvider.getList().add(item);
System.out.println("item is now " +dataProvider.getList());
}
}
If I call myListPanel.addToList("dan"), then the list is updated as
expected, but, the System output is something like:
addToList: item=dan
addToList: list is now com.google.gwt.view.client.ListDataProvider
$ListWrapper@7755c16a
Note that dataProvider.getList() is returning a ListWrapper not a
List<String>.
Elsewhere my code calls myListPanel.getList() and puts the returned
"array" into a List<String> field an object that I pass back to the
server. This of course results in a Serialization Exception, as the
object should contain a List<String> but actually contains a
ListWrapper.
The JavaDoc says that:
public java.util.List<T> getList()
Get the list that backs this model. Changes to the list will be
reflected in the model.
This is clearly not true. Is this bug going to be fixed? At the very
least the documentation should be updated asap as its misleading right
now.
Thanks,
Dan
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.