I used the gwt CellList example to implement a cell-based listbox. It used TextCell cells to represent the data, as it was just text, and worked perfectly.
Now I have to extend this list to include elements of type "tree" (I mean that you can click on some element of the list, and if it's not a leaf, it is opened and displays the information of its children). So I've implemented a CellTree-based widget. (CellTree)
My problem is that I don't know how to insert items of type "tree", which are really CellTrees, into my CellList.
The only approach I could imagine was to create a new type of cell that represents the CellTree, extending "AbstractCell", and use it as the CellList items.
My implementation is:
private class TreeCell extends AbstractCell<CellTreeListBox> {
public TreeCell() {}
@Override
public void render(Context context, CellTreeListBox value,
SafeHtmlBuilder sb)
{
sb.appendEscaped(value.getElement().getInnerHTML());
}
}
This, once included in a CellList, displays only the root nodes, but when I click on them they don't get opened! so this approach doesn't keep the events neither the functionality of the selectionModel...
So I don't know if it's possible to implement a cell that represents a whole CellTree, and keeps its events and functionalities (if you click, the node is opened and information of its children is displayed, etc...).
I'd really appreciate any information about this!