On 10/9/06, Naresh Bhatia <[EMAIL PROTECTED]> wrote:
Aha. These few sentences clarify the intent of TreeModel more that the entire javadoc for this class! Thanks so much, Adam. I was earlier thinking that TreeModel represents the entire tree and there must be something like "TreeNode" that would represent nodes in the tree. But now that you put it this way, it appears that TreeModel IS the node in the tree and, in a special case, could be the root of the tree. Is my understanding correct?
No, TreeModel is an entity that knows how to navigate around an object hierarchy. It isn't the object hierarchy itself. Start by understanding JSF's DataModel class; TreeModel is a hierarchical extension of that class.
If so, here's my follow up question (and this is the newbie speaking, so please bear with me): It appears that the approach you mention below, will keep the tree's loaded state somewhere in the web container (probably session).
No, not entirely. The expansion state will be saved using JSF state saving. But the TreeModel is as stateful as you want it to be - if you create it at request scope, it's at request scope.
Does the TreeModel support the creation of a completely stateless implementation, i.e act as a passthrough to the client? If not, is this the real difference between TreeTable and perhaps a JavaScript/AJAX implementation that will keep the complete state on the client side?
The difference between an entirely DHTML table and a JSF table is that an entirely DHTML table gives you relatively little of a server-side programming model. -- Adam
