You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Piekorz Martin <pi...@primion.de> on 2008/05/26 08:59:00 UTC
[TRINIDAD] Implementation of Treemodel for tr:tree Example or a
Howto?
Hi @ all,
does someone know or have a running example where he implemented his own treemodel? Or a example / javadoc where the whole idea how the model should be implemented is explained?
I am implementing my own treemodel. So I inherit from Treemodel and implement all the abstract methods.
In my model I have a department which has subdepartments and each subdepartment can also contain subdepartments ...
The model seems to work but the PPR seem not to work.
When I open the node in the UI then just the first child is shown. After calling refresh everything (the whole tree) is shown.
What could be the reason?
Thank a lot of.
Kind regards
Martin
Re: [TRINIDAD] Implementation of Treemodel for tr:tree Example or a Howto?
Posted by Dirk Krummacker <di...@gmail.com>.
You are writing that you implement your own TreeModel. Is it really
neccessary in your use case? In my experience the Trinidad framework
already can take care of a lot of things (including lazy loading of
children, for example).
I find the following approach very useful:
1. Create a bean that models a node/leaf in your tree with accessor
methods for properties (in your case: department name and such).
2. Add a "getChildren()" method that returns a list of these bean
instances (in your case: the subdepartments).
3. Wrap the root(s) of your tree in a list and then in a
ChildPropertyTreeModel .
A longer explanation can be found here:
http://myfaces.apache.org/trinidad/trinidad-api/apidocs/org/apache/myfaces/trinidad/model/ChildPropertyTreeModel.html
To your problem: How do you generate the children? Load them lazily
from the database? Is it possible that on the first load only the
first child is actually generated? Did you use a debugger in the place
where you create the children?
(Disclaimer: I have mostly used tr:treeTable and not tr:tree so this
may not be applicable to your case.)
HTH,
Dirk
On Mon, May 26, 2008 at 8:59 AM, Piekorz Martin <pi...@primion.de> wrote:
> Hi @ all,
>
>
>
> does someone know or have a running example where he implemented his own
> treemodel? Or a example / javadoc where the whole idea how the model should
> be implemented is explained?
>
> I am implementing my own treemodel. So I inherit from Treemodel and
> implement all the abstract methods.
>
> In my model I have a department which has subdepartments and each
> subdepartment can also contain subdepartments …
>
> The model seems to work but the PPR seem not to work.
>
> When I open the node in the UI then just the first child is shown. After
> calling refresh everything (the whole tree) is shown.
>
> What could be the reason?
>
>
>
> Thank a lot of.
>
>
>
> Kind regards
>
> Martin
>
>
Re: [TRINIDAD] Implementation of Treemodel for tr:tree Example or
a Howto?
Posted by javaRoooky <se...@gmx.de>.
test
--
View this message in context: http://www.nabble.com/-TRINIDAD--Implementation-of-Treemodel-for-tr%3Atree--Example-or-a-Howto--tp17466786p17621631.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.