Am Donnerstag, den 15.10.2009, 11:32 +0100 schrieb Alfie Kirkpatrick: > I can't comment in detail on your solution but it looks a bit convoluted > in the TML for my liking. A tree should be a first class component and > in this case I am prepared to do a little more work in the component > class to make it simple and intuitive to use.
Hi Alfie! Thank you for your thoughts and code. Meanwhile I think you are right, using a template is not very helpful as it is not easily maintainable anyway. I found out what's the problem with the If component that "are only evaluated once": the If component object is also re-used at every recursion level, and their "test" parameter is cached, so they will yield always the same result instead of recalculating it with a new test value. As this will be the case for most standard components that could be used to customize the tml, they are not usable in a situation like I was trying to set up. So, one would have to rewrite all used components to not cache their parameters which wouldn't be very practical, as it will make a mess in the tml part. I already had a tree component using a MarkupWriter that was nearly identical to the code you sent (thanks again!), the only difference was the move_next method wasn't recursive but iterative. I think I will make the component produce <ul>/<li> elements with the values of their "class" attributes configurable via a parameter. That should be enough of configurability. Regards, Dirk --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
