Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

rich:tree list order (leafs before nodes)  RSS feed

 
Skip Cole
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We are migrating to Richfaces 4 from Richfaces 3.3.2
We had a rich:tree which before, put leafs ahead of Nodes. This behavior has changed, as shown below:

-------------------------------------------------------
Before:
Root
---> Leaf A
---> Node 1
---------> Leaf B
---------> Leaf C
---------> Node 2

Now:
Root
---> Node 1
---> Leaf A
---------> Node 2
---------> Leaf B
---------> Leaf C
-------------------------------------------------------

We are using a rich:treeModelRecursiveAdaptor, and I have not been able to find a way to order the tree in the same way as was done before.

Any ideas?

Thanks,
Skip
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mostly shy aware from trying to help people with JSF tree controls, since I've had enough trouble with them myself.

From the sound of it, however, you may need to keep a few basic concepts in mind. One of which is that the UI data model isn't necessarily the same thing as the problem domain data model.

The UI data model may reference a problem domain data model, but it might provide an altered aspect of the problem domain data model. For example, a list of names fetched from a database could be fronted by a UI data model list object whose elements are references to the database data model enumerated in reverse order. And, of course, for best results, that UI data model list object should in turn be fronted by a JSF DataModel object, if you want to exploit the full functionality of the JSF dataTable control.

In other words, if the data you have doesn't appear in the order or way you like, construct an appropriate UI data model from your base data and have the UI reference that.
 
Skip Cole
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim,

I've been trying to avoid altering with the domain data model, since this is only an upgrade, and I think that In Theory Richfaces 4 should be displaying this in the same way that Richfaces 3.32 did. But this is not the case.

I have started looking into how the data model is constructed, but haven't found a quick fix for this yet. If there is any parameter setting that will make the rich:tree 4.0 display like the rich:tree 3.3.2, that would be great.

Thanks again for getting back to me on this.

 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to clarify. The term "domain data model" is normally used to indicate the object model (ORM, JPA/Hibernate Entitites, etc.).

The point of the preceeding was that the domain data model itself is often not a good fit for the UI, in which case, you'd construct a separate UI model from the domain data model.

The UI model is ONLY used in the JSF MVC subsystem. The UI model itself never persisted. Although if the UI model is a collection of data model objects (for example, a tree of table rows), changes to the data model objects within the UI model may be persisted.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!