hba
hba

Reputation: 7790

gwt cellbrowser [selecting a node] vs [opening a node]

I'm using the gwt cellbrowser, so far it has been an uphill battle. I got this bad feeling that I'm not using it as it is intended to be used.

It seems to me that:

  1. there is a difference between selecting a node and opening that node.
  2. there is no way to open/close nodes programatically.
  3. the cellbrowser's open/close handlers never fire (although clicking on a node renders that node's children in the next panel.

I'm able to use the selectionModel to select a node but that doesn't open the node. In other words, the node's children don't show up (until I click on the node).

Is there anyway, I can open and close nodes programatically?

Thanks in advance.

Upvotes: 1

Views: 414

Answers (1)

dkulesevic
dkulesevic

Reputation: 11

I hope this helps. First time helping but long time user. :)

SomeTreeModel treeModel = new SomeTreeModel();
CellBrowser cellBrowser = new CellBrowser(treeModel, null);
// this opens your first node
TreeNode firstNode = cellBrowser.getRootTreeNode().setChildOpen(0, true);
// this opens child of the first node
TreeNode secondNode = firstNode.setChildOpen(0, true);
//etc

In the TreeNode class there are several helpful methods, like, getChildValue(int index), getChildCount()...

Upvotes: 1

Related Questions