ICEfaces
  1. ICEfaces
  2. ICE-1395

Tree problem: setting "hideRootNode" equals "true" makes the whole tree unrendered

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: 1.7DR#3, 1.7
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      FF 2.0
      Tomcat 5.5

      Description

      setting "hideRootNode" equals "true" makes the whole tree unrendered.
      Not sure if its the desired behavior, it will be redundant to "rendered" attribute if it's the case

        Activity

        Hide
        Sheng Gu added a comment -

        Sorry, what I stated above is associated with another bug:
        When condition meets: (hideRootNode && currentNode.getNextSibling() == null
        && currentNode == rootTreeNode.getFirstChild())
        it should have two situation expanded=true and expanded=false, but source code only have one situation.

        Show
        Sheng Gu added a comment - Sorry, what I stated above is associated with another bug: When condition meets: (hideRootNode && currentNode.getNextSibling() == null && currentNode == rootTreeNode.getFirstChild()) it should have two situation expanded=true and expanded=false, but source code only have one situation.
        Hide
        Sheng Gu added a comment -

        Sorry, I disagree with <the setExpanded attribute should be set to "true" when the hideRootNode="true">. When hideRootNode=true, the root's first child may have its children. So, the first node may expanded=true or expanded=false.

        (root 0) //hidden
        [+]node 1 //expanded=false

        (root 0) //hidden
        [-]node 1 //expanded=true

        • node 1-1
        • node 1-2
        Show
        Sheng Gu added a comment - Sorry, I disagree with <the setExpanded attribute should be set to "true" when the hideRootNode="true">. When hideRootNode=true, the root's first child may have its children. So, the first node may expanded=true or expanded=false. (root 0) //hidden [+] node 1 //expanded=false (root 0) //hidden [-] node 1 //expanded=true node 1-1 node 1-2
        Hide
        Adnan Durrani added a comment -

        This is not a bug, as Brian Truitt mentioned that the setExpanded attribute should be set to "true" when the hideRootNode="true".

        Show
        Adnan Durrani added a comment - This is not a bug, as Brian Truitt mentioned that the setExpanded attribute should be set to "true" when the hideRootNode="true".
        Hide
        Sheng Gu added a comment -

        It seems that my code above fix this bug as follows: when hideRootNode = true, rootNode only have one child (currentNode.getNextSibling() == null && currentNode == rootTreeNode.getFirstChild()), then expanded = true or expanded=false always display "". It should be "" when expanded=true, and "-" when expanded=false.

        Show
        Sheng Gu added a comment - It seems that my code above fix this bug as follows: when hideRootNode = true, rootNode only have one child (currentNode.getNextSibling() == null && currentNode == rootTreeNode.getFirstChild()), then expanded = true or expanded=false always display " ". It should be " " when expanded=true, and "-" when expanded=false.
        Hide
        Sheng Gu added a comment -

        I think there is a bug in TreeRenderer encodeNode method (line 500). Following is my suggestion:

        This is current code:
        if (currentNode.isRoot() && !isExpanded ||
        hideRootNode
        && currentNode.getNextSibling() == null
        && currentNode == treeComponentRootNode.getFirstChild()
        )

        { iconImage.setAttribute(HTML.SRC_ATTR, treeComponent.getNavOpenTopNoSiblingsImage()); }

        It should be:
        if (currentNode.isRoot() || hideRootNode
        && currentNode.getNextSibling() == null
        && currentNode == rootTreeNode.getFirstChild()) {
        if (isExpanded)

        { iconImage.setAttribute(HTML.SRC_ATTR, treeComponent.getNavCloseTopNoSiblingsImage()); }

        else

        { iconImage.setAttribute(HTML.SRC_ATTR, treeComponent.getNavOpenTopNoSiblingsImage()); }

        }

        Show
        Sheng Gu added a comment - I think there is a bug in TreeRenderer encodeNode method (line 500). Following is my suggestion: This is current code: if (currentNode.isRoot() && !isExpanded || hideRootNode && currentNode.getNextSibling() == null && currentNode == treeComponentRootNode.getFirstChild() ) { iconImage.setAttribute(HTML.SRC_ATTR, treeComponent.getNavOpenTopNoSiblingsImage()); } It should be: if (currentNode.isRoot() || hideRootNode && currentNode.getNextSibling() == null && currentNode == rootTreeNode.getFirstChild()) { if (isExpanded) { iconImage.setAttribute(HTML.SRC_ATTR, treeComponent.getNavCloseTopNoSiblingsImage()); } else { iconImage.setAttribute(HTML.SRC_ATTR, treeComponent.getNavOpenTopNoSiblingsImage()); } }
        Hide
        Brian Truitt added a comment -

        When you set hideRootNode to "true" did you remember to take your root node and setExpanded to true?

        If the root node is both hidden and not expanded then you won't get a tree rendered...

        Show
        Brian Truitt added a comment - When you set hideRootNode to "true" did you remember to take your root node and setExpanded to true? If the root node is both hidden and not expanded then you won't get a tree rendered...

          People

          • Assignee:
            Unassigned
            Reporter:
            Sam Xiao
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: