Found in GWT Release (e.g. 2.4.0, 2.5.0 RC): 2.4.0
Encountered on OS / Browser (e.g. WinXP, IE8-9, FF7): Win7 FF3.6
Detailed description (please be as specific as possible):
When programatically opening a TreeNode's child that was the last thing opened and
it either had a null NodeInfo or was a leaf, the NodeInfo is never reloaded from the
model. This is due to the fact that if NodeInfo is null or the child was a leaf when
it was first loaded, the BrowserCellList's isFocusOpen flag is false and therefore
when the node is closed the focusedKey flag is never cleared due to the statement on
lines 1133/4 in CellBrowser. This issue is partially related to issue 6994 which I
created separately because they are caused by different logic flow, but may or may
not be solved by a single patch. Perhaps this is acting as expected, but if so there
should also be a way to force the node to reload from the model.
Shortest code snippet which demonstrates issue (please indicate where
actual result differs from expected result):
Click the "Item" node, then click "Switch". Compare to clicking "Switch" before "Item".
private final ListDataProvider<String> dataProvider = new ListDataProvider<String>(Arrays.asList("Item"));
private boolean nullChild = true;
@Override
public void onModuleLoad()
{
TreeViewModel model = new TreeViewModel()
{
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public <T> NodeInfo<?> getNodeInfo(T value)
{
return value == null || !nullChild ? new DefaultNodeInfo(dataProvider,
new TextCell()) : null;
}
@Override
public boolean isLeaf(Object value)
{
return false;
}
};
final CellBrowser cb = new CellBrowser(model, null);
RootLayoutPanel.get().add(cb);
Button button = new Button("Switch");
button.addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
nullChild = false;
TreeNode rootNode = cb.getRootTreeNode();
if (rootNode.isChildOpen(0))
{
rootNode.setChildOpen(0, false);
rootNode.setChildOpen(0, true);
}
}
});
final PopupPanel popupPanel = new PopupPanel();
popupPanel.setWidget(button);
popupPanel.setPopupPositionAndShow(new PositionCallback()
{
@Override
public void setPosition(int offsetWidth, int offsetHeight)
{
popupPanel.setPopupPosition(Document.get().getClientWidth() - offsetWidth
- 5, Document.get().getClientHeight() - offsetHeight - 5);
}
});
}
Workaround if you have one:
None.
Originally reported on Google Code with ID 6998
Reported by
lineman78
on 2011-11-16 19:44:19