jakartaee / jakartaee/faces

Provide a component for iterating over hierarchical data

Open
#965 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Components/Renderers Priority: Minor Type: Sub-task
Dominant language
Java
Stars
127
Forks
59
Avg merge
23h
Merged PRs (30d)
7

Description

With the integration of Facelets into JSF 2.0 a component for iterating over list data (UIRepeat) that does not render any markup itself was introduced in the spec. This is very useful for creating "table" like composite components that render custom markup.
A similar component for rendering hierarchical data does not exist. There should be a general component(s) for iterating tree structures e.g. "UITreeData", that does not render any output itself but allows rendering of hierarchical HTML tree structures like

  • .
    There is currently no support of rendering hierarchical data structures with facelets/composite components with an unlimited depth (and user defined markup). Nesting a composite component inside itself is not an option as it leads to an infinitely nested component tree.

    A component that only iterates a hierarchical data structure would allow creating "tree" like composite components that render custom markup.

    The usage could look something like:

    • Node value: #

      {node.someData}


    It is possible to implement a similar "workaround" component on top of UIData with a special renderer for UIData + UIColum and a UIOutput for the "tree childs". The iteration over the tree nodes can be recursively done in the renderer of the "tree childs".
    Using UIData as the wrapping base component saves the developer from implementing the complicated state saving and tree visiting. The downside is: it is not easy to "trick" UIData to use hierarchical data with a special DataModel. This is because it only supports an integer as the index of the current row. A more general base class would be much more suitable. See improvement #963.
    BTW: The described "workaround" component is used on the CeBit site ([http://www.cebit.de/en/about-the-trade-show/programme/exhibitors-products/sector-index](http://www.cebit.de/en/about-the-trade-show/programme/exhibitors-products/sector-index)) and even supports AJAX out of the box. I may provide the source for illustration.

    I think the suggested component really should be part of the spec as it significantly enhances the possibilities when creating composite components. Creating an own tree component is easy with it. It could also be a base for many other "tree" component implementations.
    #### Affected Versions
    [2.2]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing UIRepeat and UIData concepts, including the UIColumn workaround described in the issue, and read improvement #963 for the proposed general base class. Done means defining a specification-level component that iterates hierarchical data to support unlimited-depth, user-markup tree structures without rendering its own markup.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.