-
1. Re: rich:tree help for displaying folders under a directory
nbelaevski Nov 7, 2009 11:22 AM (in response to tekjava)Hi,
What's the problem with doing that? -
2. Re: rich:tree help for displaying folders under a directory
tekjava Nov 7, 2009 10:41 PM (in response to tekjava)Hi,
Let's say I have three folders: folder1, folder2, and folder3 in C:\temp directory. I am trying to get the three folders in xhtml using a similar rich:tree snippet like:
<h:form>
<rich:tree style="width:300px" switchType="ajax" stateAdvisor="#{treeDemoStateAdvisor}">
<rich:recursiveTreeNodesAdaptor roots="#{fileSystemBean.sourceRoots}" var="item" nodes="#{item.nodes}" />
</rich:tree>
</h:form>
I am able to present folder1, folder2, and folder3 in tree. (At least I can do this).
But when I select any one of them, instead of getting the files and subdirectories of the folder, I am getting folder1,folder2, and folder3 again as subdirectories. I mean if I select folder1 in tree, I see folder1,folder2,folder3 as children elements. When I select one of the children folders, I am again getting folder1, folder2, and folder3. I think I can continue to get the same content till there is an Out Of Memory stack overflow.
I think I have a problem in my stateAdvisor. I am using the one provided
in one of your demos.
public class TreeDemoStateAdvisor implements TreeStateAdvisor {
public Boolean adviseNodeOpened(UITree tree) {
if (!PostbackPhaseListener.isPostback()) {
Object key = tree.getRowKey();
TreeRowKey treeRowKey = (TreeRowKey) key;
if (treeRowKey == null || treeRowKey.depth() <= 2) {
return Boolean.TRUE;
}
}
return null;
}
public Boolean adviseNodeSelected(UITree tree) {
return null;
}
}
I think the problem is I cannot get a relation between my data model and UI Tree, and I keep getting the same main folders as children folders over and over.
Any help would be appreciated greatly.
Thanks, -
3. Re: rich:tree help for displaying folders under a directory
nbelaevski Nov 8, 2009 6:03 AM (in response to tekjava)Hi,
It's easy to check whether it's the thing really causing problems - just remove "stateAdvisor" attribute.