public void setModel(TreeModel model) { if (model != null) { if (_model != model) { if (_model != null) { _model.removeTreeDataListener(_dataListener); } else { if (_treechildren != null) _treechildren.detach(); //don't call getItems().clear(), since it readonly //bug# 3095453: tree can't expand if model is set in button onClick smartUpdate("model", true); } clearSelection(); _model = model; initDataListener(); } doSort(this); syncModel(); } else if (_model != null) { _model.removeTreeDataListener(_dataListener); _model = null; if (_treechildren != null) _treechildren.detach(); //don't call getItems().clear(), since it readonly //bug# 3095453: tree can't expand if model is set in button onClick smartUpdate("model", false); } }