Phil:
You're right that DefaultPersistentMetadata won't preserve order of fields, but I'm
not sure that's the problem that Steve is seeing. Correct me if I'm wrong, Steve, but
it sounds like what you're saying is that you're putting things together in the order
you want them in the Model, but not getting them out in that order on the JSP page?
Mike
On 01 Oct 2003 13:47:10 -0400
Philip J Brown <[EMAIL PROTECTED]> wrote:
> Mike (and others),
>
> The DefaultPersistentMetadata class uses HashSet, TreeSet, HashMap and
> TreeMap to store values internally. None of these collections maintain
> the elements in the same order that they were returned.
>
> There are (as of jdk 1.4) LinkedHashMap and LinkedHashSet classes that
> do preserve the order in which elements were added.
>
> Changing this class (and possibly other related classes) to use these
> "linked" version of the set and map classes may fix the problem.
>
> Hope this helps.
>
> -Phi
> On Wed, 2003-10-01 at 08:58, Michael Nash JGlobal.com wrote:
> > Steve:
> >
> > > Order is definately NOT being preserved. Part of the problem may be (and will
> > > eventually be) the fact that the titles come from one table, and the data may
> > > (or may not) be loaded from another table.
> >
> > What I meant by preserved though, was that the order you nest the outputs in the
> > Model should be the order they're displayed in the JSP. In this situation that may
> > not help you, as far as I can see, so the nested elements should be named.
> >
> > > I did have a look at the "List" model in CRUD, but it is guaranteed to be
> > > pulling headers and data from the same table. Its also doing some additional
> > > stuff that I am not at the moment, and I am having some trouble following
> > > some of what it is doing.
> >
> > It's a fun one, no question :-). What you should be able to do is something like
> > this:
> > Output top = res.createOutput("top");
> > Output row = res.createOutput("row1");
> > top.add(row);
> > start your loop.....
> > Output column = res.createOutput("firstColumnName");
> > row.add(column);
> > .... for each column....
> >
> > then in the JSP you can retrieve each "row", then call for the columns in a
> > specific name order (perhaps by iterating through the collection of headers again
> > - if you name the *output* of each header the same as the actual column name, that
> > might be an easy way to do it....
> >
> > HTH!
> >
> > > Bottom line, I am seeing Titles and columns that are not being displayed in the
> > > same order. Specifically, columns are all displayed lined up, but not
> > > necessarily under their correct titles.
> > >
> > > I already have the outputs placed by column name, so I am trying to figure out
> > > how to fish them out again. One of the requirements I am looking at is the
> > > ability to rearrange the order of the columns displayed on the fly, so
> > > being able to call the stuff back out on demand would be a great help.
> > >
> >
> > Michael Nash
> >
> > JGlobal Ltd.
> > http://www.jglobal.com
> >
> > Bahamas Commerce and Trade
> > http://www.bahamascommerce.com
> >
> > http://keelframework.org/documentation
> > Keelgroup mailing list
> > [EMAIL PROTECTED]
> > http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com
> >
>
> http://keelframework.org/documentation
> Keelgroup mailing list
> [EMAIL PROTECTED]
> http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com
Michael Nash
JGlobal Ltd.
http://www.jglobal.com
Bahamas Commerce and Trade
http://www.bahamascommerce.com
http://keelframework.org/documentation
Keelgroup mailing list
[EMAIL PROTECTED]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com