Re: Dynamically Processing Nodes
"Suroor Jakoet" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Diez, Im taking over from where Kirk left off. Lets see if I have it correctly. You are saying that we should take the existing 'tree' structure, create a list from it and then render the rows from this list. If my interpretation is correct, then the rows would know in which order they must be rendered but not how the hierarchy should look. Therefore, I dont think this approach would work. I think that the hierarchy problem can be solved by some type of recursive functionality. Is there not, perhaps, a recursive model (wishfull thinking) ? Regards, Suroor >>> [email protected] 12/3/2003 10:01:15 PM >>> Hi, > Nah, > I've got parent/child loops nailed. Good to know :) > It has more to do with using the Iterative Model and dynamically > "growing it"...?? I still think that its basically the way I said before - what you have with you rows is a tree. To create a flat list of rows (or RowCollections) you'll have to traverse this tree with an vistor like this: class RowVisitor { List _rowList = new LinkedList(); public void visit(List rows) { for(Iterator it = rows.iterator(); it.hasNext();) { visit((Row)it.next()); } } public void visit(Row row) { _rowList.add(row); for(Iterator it = row.getRowCollection().iterator(); it.hasNext();) { visit((Row)it.next()); } } } This should end up with a list of rows in the correct order. Now for the rendering - the rowspan is (1 + row.getRowCollection().size()). Maybe you have to make the visitor tag the rows with additional information like depth to make the rendering of the colspan easier. The colspan is (3 - depth). Does this give you an idea? 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.