lmo
lmo

Reputation: 547

Populate a CellTree with ListDataProvider

I'm currently developing a custom Tree in GWT (extending AbstractEListViewer)

I want to populate a CellTree with a ListDataProvider, but I can't do it like I do it for a CellList, by using AbstractDataProvider.addDataDisplay(HasData<SomeClass>) because CellTree doesn't implements HasData<T> ..

Variables :

protected transient CellTree treeViewer;
protected static ListDataProvider<SomeClass> provider;

Code :

@Override
protected Widget createViewer(EWidgetInit init, Container parent) {
    TreeViewModel model = new CustomTreeModel();
    treeViewer = new CellTree(model, null);

    provider = new ListDataProvider<SomeClass>();
    provider.addDataDisplay(treeViewer); // not applicable for the arguments (CellTree)

    return treeViewer.asWidget();
}

Error :

The method addDataDisplay(HasData) in the type AbstractDataProvider is not applicable for the arguments (CellTree)

At the moment, Tree is displayed on the webpage but it displays "empty", as it is not populated of course:

Does anybody know how to populate this CellTree?

Upvotes: 0

Views: 102

Answers (1)

lmo
lmo

Reputation: 547

Solved this problem by deleting this line:

    provider.addDataDisplay(treeViewer); // not applicable for the arguments (CellTree)

and instantiating ListDataProvider before the CellTree.

Upvotes: 1

Related Questions