Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-350

Use 'node.isLeaf()' in tree2 to decide whether to display the navigation icon

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.1.0
    • 1.1.0
    • None
    • None
    • IBM RAS using MyFaces JSF implementation

    Description

      I would like to suggest the following enhancement to Tree2 that would make it more amenable to grabbing data "on the fly" as the user is expanding nodes. Here's the problem:

      Currently, Tree2 does not display the + navigation icon if the number of child nodes is zero, regardless of whether there are children yet to be fetched. What I'd like to have happen is that the + navigation icon is displayed only if the node is not a leaf node, regardless of whether there are currently child nodes.

      In other words, I would like to have the following line in HtmlRenderer.encodeNavigation() changed from:

      bitMask += (node.getChildCount()>0) ? CHILDREN : NOTHING;

      to:

      bitMask += (node.isLeaf) ? CHILDREN : NOTHING;

      If we make this change, then the application developer has more control over whether the + navigation symbol appears, since the application developer can override the isLeaf() method in the node itself.

      Currently, the workaround is to override the node's getChildCount() method to return the number of records expected if the user were to request the fetch. However, the "expected" number of records is not always known, so, in these cases, getChildCount() would have to be coded to return an arbitrary number greater than zero, which is kind of a kluge.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bc1378@sbc.com Brendan Conner
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: