Re: Dynamically Processing Nodes
"Kirk Daries" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Diez,
Nah,
I've got parent/child loops nailed.
It has more to do with using the Iterative Model and dynamically
"growing it"...??
I have the following Objects:
Row
RowsCollection
A row can contain other rows(RowsCollection).
Processing Rows with no children is pretty simple.
e.g.
I can output the following:
<table border="1">
<tr>
<td colspan="3">Row 1</td>
<td><input type="Text" size="3"></td>
</tr>
<tr>
<td colspan="3">Row 2</td>
<td><input type="Text" size="3"></td>
</tr>
</table>
However, if a row contains children, I'd like to render something like
this..
e.g.
<table border="1">
<tr>
<td colspan="3">Row 1</td>
<td><input type="Text" size="3"></td>
</tr>
<tr>
<td rowspan="3">Row 2</td>
<td colspan="2">Row 2.1</td>
<td><input type="Text" size="3"></td>
</tr>
<tr>
<td rowspan="2">Row 2.2</td>
<td>Row 2.2.1</td>
<td><input type="Text" size="3"></td>
</tr>
<tr>
<td>Row 2.2.2</td>
<td><input type="Text" size="3"></td>
</tr>
<tr>
<td colspan="3">Row 3</td>
<td><input type="Text" size="3"></td>
</tr>
Anyway.....
Since the Rows are specified in a config file, the renderer doesn't
know the layout and relationships between the rows.
Getting back to my markup..
<tr class="Dir::Iterate_Start.GridRows Dir::Iterate_Next.GridRows">
<td class="Dir::Get_Data.GridRows.Label" valign="top">[ROW
LABEL]</td>
</tr>
<tr class="Dir::Iterate_End.GridRows
Dir::Discard"><td>[DISCARD]</td></tr>
"ROW LABEL" Should either return a 'Text Label' or if a row contains
children, the markup for the children...
Urrm....
Did that make sense?
--KD
>>> [email protected] 2003/12/03 13:50:21 >>>
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
_______________________________________________
Barracuda mailing list
[email protected]
http://barracudamvc.org/lists/listinfo/barracuda
---------------------------------------------------------------
All views or opinions expressed in this electronic message
and its attachments are the view of the sender and do not
necessarily reflect the views and opinions of the
Provincial Government Western Cape (the PGWC).
No employee of the WCPG is entitled to conclude a
binding contract on behalf of the PGWC unless he/she
is an Accounting Officer of the PGWC, or his or her
authorised representative.
The information contained in this message and its attachments
may be confidential or privileged and is for the use of the
named recipient only, except where the sender specifically
states otherwise. If you are not the intended recipient you
may not copy or deliver this message to anyone.