Re: Dynamically Processing Nodes
"Diez B. Roggisch" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, > At the moment, I have Column and Row Objects. > A Column can be added other Columns. The same goes for Rows. > > Now, once I process a row, I need to check if the current row contains > any children. > If it does, execute the same Iterator loop and process the child Rows. > Question is... how do I accomplish this...? I'm not so sure what exactly you want to do here - you want control over rows as well as over the columns one row has? You need a parent-child iterative model. There have been quite a few discussions about this on the list. Your markup looks basically like this: <tr class="Dir::Iterate_Start.RowModel Dir::Iterate_Next.RowModel"> <td class="Dir::Iterate_Start.ColModel Dir::Iterate_Next.ColModel"> </td> <td class="Dir::Iterate_End.ColModel Dir::Discard"> </td> </tr> <tr class="Dir::Iterate_End.RowModel Dir::Discard"> <td></td> </tr> The question of yours, about rows in the same iterator-loop - that's not so hard. The easiest way would be to "flatten" your tree of rows - for that, you simply traverse it in preorder and add the rows to a list. That list backs up your rows-model. Now for the columns - thats a little bit tricky, as I'm not sure how you want your layout. It contains some errors - maybe you can look at that again? Regards, Diez