Actually, on second inspection, that's not quite it.
The Tacos components uses CSS to indent the data:
<div style="margin-left: 0px">
Parent
</div>
<div style="margin-left: 16px">
Child
</div>
But for my purposes (because of javascript manipulation of the DOM),
it's very important that the tags actually *be nested* recursively:
<div class="tree-node">
Parent
<div class="tree-node">
Child
</div>
</div>
So I guess it's not what I'm after. Slick component, though!
Cheers,
Paul
On Aug 10, 2005, at 4:56 PM, Viktor Szathmary wrote:
Check out the Tacos Tree component (http://tacos.sf.net/). The source
has a TreeIterator that you can use independently to flatten out
hierarchical iterations so you can use a regular Foreach (while
tracking depth)...
check the source for:
http://cvs.sourceforge.net/viewcvs.py/tacos/tacos/src/net/sf/tacos/
tree/TreeIterator.java?rev=1.2&view=auto
viktor
On 8/10/05, Paul Cantrell <[EMAIL PROTECTED]> wrote:
Suppose I have some data like this:
public interface TaxonomyTree
{
public String getAnimalName();
public Set<TaxonomyTree> getChildren();
}
...and suppose I want to render it in a page with a recursively
nested structure, so that my HTML tag structure matches the tree
structure of the data:
<div>
Birds
<div> Hummingbird </div>
<div> Warbler </div>
<div> Raptor
<div> Eagle </div>
<div> Vulture </div>
</div>
</div>
<div>
Mammals
<div> Platypus </div>
...etc...
Of course, *if* I know that the tree is n levels deep, I can render
it with n nested @For components (though it's pretty ugly!). But if I
don't know the depth of the tree, I need true recursion.
Is there a way to do this without writing a custom component for my
specific data? Is anybody aware of a generic component that will do
the job? I'm hoping for something like this:
<span jwcid="[EMAIL PROTECTED]"
source="ognl:treeRootNodes">
<div>
<span jwcid="@Insert"
value="ognl:components.animalTree.value.animalName" />
<span jwcid="@RecursiveChildren" loop="animalTree"
value="ognl:components.animalTree.value.children" />
</div>
</span>
If nobody's aware of such a thing, I might try my hand at writing it.
But I'd rather spare myself the effort if there's already a good
solution out there....
Cheers,
Paul
_________________________________________________________________
"Les grandes personnes ne comprennent jamais rien toutes seules,
et c'est fatigant, pour les enfants, de toujours et toujours
leur donner des explications." -- Antoine de Saint-Exupéry
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: tapestry-user-
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
"The pursuit of truth and beauty is a sphere of activity in which
we are permitted to remain children all our lives."
-- Albert Einstein
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]