I try to delete a node in tree2 backing model, and a Father of this node is expanded (to view the child)
and then Im geting a new data for the model (without deleted node),
then I get an:

ServletException: Encountered a node [0:4:3:0] + with an illogical state. Node is expanded but it is also considered a leaf (a leaf cannot be considered expanded.
...

i have no Exceptions if Father is not expanded.
is it MyFaces bug or my?

I can not show all my code, these are the essential tiles of it.


public class CategoryNode implements TreeNode {

        ...

        /** @see org.apache.myfaces.custom.tree2.TreeNode#isLeaf() */
        public boolean isLeaf() {
                if (children == null) {
                        return true;
                }
                if (children.isEmpty()) {
                        return true;
                }
                return false;
        }

        ...

}


public class CatAdminBean { //catadmintab
        ...
        public TreeNode getTree() {
                if (tree == null) {
                        CatNodeInfo root =...;
                        tree = new CategoryNode(root);
                }
                return tree;
        }

        ...

        /** removes category from the tree */
        public String removeCategory() {
                // do the delete logic
                tree = null;
        }
        ...
}


catadmin.jsp:
        ...
<%-- treepanel--%>
<t:aliasBean alias="#{panel}" value="#{catadmin}">
<f:subview id="treepanel">
<jsp:include page="inctree.jsp"/>
</f:subview>
</t:aliasBean>
        ...



inctree.jsp:
        ...
<t:tree2 showRootNode="false"
        value="#{catadmin.tree}"
        clientSideToggle="true"
        var="node" varNodeToggler="t">
        <f:facet name="category">
                                <h:panelGroup>
                                        <f:facet name="expand">
<h:graphicImage value="../images/yellow-folder-open.png" rendered="#{t.nodeExpanded}"/>
                                        </f:facet>
                                        <f:facet name="collapse">
                                                <h:graphicImage 
value="../images/yellow-folder-closed.png"
                                                        
rendered="#{!t.nodeExpanded}"/>
                                        </f:facet>
<h:outputText value="#{node.name}" title="#{node.path}" styleClass="nodelabel"/>
                                        <h:outputText value=" (#{node.childCount})" 
styleClass="nodelabel"
                                                rendered="{!empty 
node.children}"/>
                                </h:panelGroup>
                        </f:facet>
        
                        <f:facet name="document">
                                <h:panelGroup>
                                        <h:graphicImage 
value="../images/document.png" />
                                        <h:outputText
                                                        value="#{node.name}" 
title="#{node.path}"
                                                        styleClass="nodelabel" 
/>
                                </h:panelGroup>
                        </f:facet>
                </t:tree2>
        ...


        

        
                
___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

Reply via email to