we could copy the array and give you that, but the iterator you've already got access to will be faster, so i don't really see the point. and in the near future, it won't even be harder to get at the elements with 1.5 iterator syntax. both forms would be "for (Component child : container.x()) { }"

the current solution to this is like in listview. you recreate the kids rather than reusing them...

Igor Vaynberg wrote:

sorry, but i think that reordering children is something we ought to think about quite a bit before implementing. and in any case it should not be implemented by exposing the guts of markupcontainer, which may or may not use an array as a backing store for child components in the future.

Ok I understand that. Item order is not a formal contract. It would still be
nice to get an array w/out the writethrough that represents the children if
it can be done more efficiently then
ArrayList a=new ArrayList(size());
Iterator it=iterator();
While (it.hasNext()) { a.add(it.next()); }

i closed the bug as won't fix. you should think about your problem in dataview and try to explain why it is that you need to reorder children that /you added/.

The children need to be reorder when optimized item removal is on and you
are dealing with dynamic data:
IE:
at time of request 1 your collection looks like A,B.
At time of request 2 your collection looks like A,C,B because C was added
between the two requests. So now you have to change the render order without
recreating A or B.

If I had a writethrough array I could easily rearrange the items with a
quicksort. Currently I keep the index that the item should be rendered with
in the datakte and do the following before rendering

                final ArrayList children=new ArrayList(size());
                Iterator it=iterator(); while (it.hasNext()) {
children.add(it.next()); }
                Collections.sort(children,
DataItemByIndexComparator.INSTANCE);
                return new ReadOnlyIterator() {
                        private int index=0;
                        public boolean hasNext() { return
index<children.size(); }
                        public Object next() {
                                Object o=children.get(index);
                                index++;
                                return o;
                        }
                };


So given the current situation is this the most efficient way to do it?

-Igor




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to