I am trying to create a cell browser , gettign help from GWT Showcase
Here i am creating CellBrowser
final MultiSelectionModel<MyDTO> selectionModel = new MultiSelectionModel<MyDTO>();
CellBrowser cellBrowser = new CellBrowser(new ContactTreeViewModel(selectionModel), null);
What i am not getting is that , What is ContactTreeViewModel? I have read the class contacttreeviewmodel in GwtShowcase , but couldnt understand, what is it exactly
thanks for the help
It’s your view model, that is the interface between the tree view and your actual model (in MVC or MVP parlance). The
CellBrowser(same for aCellTree) will ask yourTreeViewModelfor the nodes of the tree (in the form ofNodeInfoobjects), their children, how to display them (the associatedCell), how to select them (the associatedSelectionModel: you can have a tree where you can only select nodes from the 2nd level, and/or only one node per branch at the 2nd level, or any node, or …), and finally how to update them (theValueUpdater).Basically (disclaimer: this is a simplification of the process!), each level in the tree is a
CellListthat aNodeInfois responsible for. ThesetDataDisplayassociates thatCellListwith theNodeInfoso that changes to the model can be reflected in the tree, then theCell,ProvidesKey,SelectionModelandValueUpdaterall have the same behavior as for aCellList. TheCellBrowserasks yourNodeInfofor them in order to setup theCellList. When expanding a node, theCellBrowserasks yourTreeViewModelfor theNodeInfoassociated to the expanded node and uses it to create a newCellList.The
ContactTreeViewModelfrom the Showcase is thus a specific implementation of theTreeViewModelto display contacts (the model) as a tree.