UIData needs review on a couple of fronts (JAVASERVERFACES_SPEC_PUBLIC-935)

[JAVASERVERFACES_SPEC_PUBLIC-965] Provide a component for iterating over hierarchical data Created: 07/Apr/11  Updated: 01/Aug/14

Status: Open
Project: javaserverfaces-spec-public
Component/s: Components/Renderers
Affects Version/s: 2.2
Fix Version/s: None

Type: Sub-task Priority: Minor
Reporter: Mathias Werlitz Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Status Whiteboard:

size_large importance_medium


 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 <ul><li>.
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:
<ul>
<ui:tree value="#

{myTree}

" var="node" varStatus="status">
<li>Node value: #

{node.someData}

<ul>
<ui:treeChilds />
</ul>
</li>
</ui:tree>
</ul>

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 JAVASERVERFACES_SPEC_PUBLIC-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) 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.



 Comments   
Comment by kito75 [ 19/Apr/11 ]

I would argue that any such component should render as a simple tree (with basic features like expanding/collapsing nodes, images for folders and leaves, etc.) by default, like UIData does. I would also expect a standard TreeModel.

Comment by Mathias Werlitz [ 19/Apr/11 ]

Well the idea is not to implement a complex tree component, but allow rendering of hierachical markup like <ul><li> in general, leaving the developer of an application the flexibility to render any content.

Infact my "workaround" component uses a special DataModel impl. (to let UIData think the nodes are sequential rows) and a very simple interface for tree nodes. But this interface only allows to get the childs of a node, nothing more. The component does not know anything about the tree state, it does only iterate over the data. Tree state is part of a custom user definded model (in this case: of the node) and the facelets template.

Comment by Ed Burns [ 01/Aug/14 ]

Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

Comment by Manfred Riem [ 01/Aug/14 ]

Setting priority to Minor

Generated at Tue Sep 01 14:44:50 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.