Title: 郵件
Hi All
 
I test the scenario from David.
I found that TreeModel won't hook ModelListener in HtmlTree
because when you try to use DefaultTreeModel to build a TreeModel.
You just do
DefaultTreeModel treeModel = new DefaultTreeModel(root);
and this construction won't hook any listener.
I think maybe the scenario as follows will work.
 
// Resolve the tree table.
FacesContext facesContext = FacesContext.getCurrentInstance();
VariableResolver vr = facesContext.getApplication().getVariableResolver();
RoleTreeTable roleTree = (RoleTreeTable)vr.resolveVariable(facesContext,RoleTreeTable.ROLE_TREE_TABLE);
 
//you should hook listener if you want to construct a tree model.
//roleTree.setTreeModel(SecurityApplicationUtils.buildRoleTreeModel());
 
DefaultMutableTreeNode root = (DefaultMutableTreeNode)roleTree.getTreeModel().getRoot();
//add new node or remove node in root
DefaultMutableTreeNode target = null;//target is the node that will be added or removed
DefaultMutableTreeNode parent = null;//parent is the parent node of target
...........
 
 
roleTree.getTreeModel().nodeStructureChanged(parent);
 
 
 
 
 
ohara

Reply via email to