ICEfaces
  1. ICEfaces
  2. ICE-3041

ice:tree hideRootNode="true" causes perceived root node to always show the plus icon, even when expanded

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7RC1
    • Fix Version/s: 1.7.1
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      deployed as portlet in liferay

      Description

      I have an ice:tree component with hideRootNode="true", and a backing bean that populates the model the value attribute is bound to.

      When the tree renders it always shows a plus icon next to the perceived root node (actually the child of the root node, since the hideRootNode is set to true).
      i.e.,
        <invisible root node>
              + <perceived root>

      The plus icon on the perceived root never changes to minus, whether the node is expanded or collapsed.

      If I change the hideRootNode to false, then I see the true tree root node and all the +/- expand/contract icons work correctly.

      Image attached.
      1. icetreebug.JPG
        25 kB
      2. screenshot-1.jpg
        135 kB
      3. screenshot-2.jpg
        140 kB
      4. screenshot-3.jpg
        138 kB
      5. screenshot-4.jpg
        142 kB
      6. screenshot-5.jpg
        140 kB
      7. screenshot-6.jpg
        146 kB

        Activity

        Hide
        Andrew Longley added a comment -

        one additional note: it seems to only be an issue when there is a single perceived root node of the hidden root node. If there are two perceived root nodes of the hidden root node, the problem goes away, i.e.,

        <invisible root node>

        • <perceived root 1>
        • <perceived root 2>
          + child 1
        Show
        Andrew Longley added a comment - one additional note: it seems to only be an issue when there is a single perceived root node of the hidden root node. If there are two perceived root nodes of the hidden root node, the problem goes away, i.e., <invisible root node> <perceived root 1> <perceived root 2> + child 1
        Hide
        Sheng Gu added a comment -

        Hi ICEfaces team,

        I think that the bug may be fixed by replacing the following the code snippet 1 in TreeRenderer.java with the code snippet2:

        <!-- snippet1 -->
        if (currentNode.isRoot() && !isExpanded ||
        hideRootNode
        && currentNode.getNextSibling() == null
        && currentNode == treeComponentRootNode.getFirstChild()
        )

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

        <!-- snippet 2 -->
        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 - Hi ICEfaces team, I think that the bug may be fixed by replacing the following the code snippet 1 in TreeRenderer.java with the code snippet2: <!-- snippet1 --> if (currentNode.isRoot() && !isExpanded || hideRootNode && currentNode.getNextSibling() == null && currentNode == treeComponentRootNode.getFirstChild() ) { iconImage.setAttribute(HTML.SRC_ATTR, treeComponent.getNavOpenTopNoSiblingsImage()); } <!-- snippet 2 --> 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
        yip.ng added a comment -

        There is another problem when there are more than one top level node: the line connecting the first and second icons is broken. See screenshot-1.

        Show
        yip.ng added a comment - There is another problem when there are more than one top level node: the line connecting the first and second icons is broken. See screenshot-1.
        Hide
        yip.ng added a comment -

        Also, when there are more than one top level node, the first icon is not aligned properly. See screenshot-2.

        Show
        yip.ng added a comment - Also, when there are more than one top level node, the first icon is not aligned properly. See screenshot-2.
        Hide
        yip.ng added a comment -

        Changes made based on Sheng Gu's suggestion, plus additional changes to fix the additional problems.

        Show
        yip.ng added a comment - Changes made based on Sheng Gu's suggestion, plus additional changes to fix the additional problems.

          People

          • Assignee:
            Unassigned
            Reporter:
            Andrew Longley
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: