Thanks for your comments, Andre.

http://gwt-code-reviews.appspot.com/132817/diff/2001/20
File user/src/com/google/gwt/user/client/ui/StackLayoutPanel.java
(right):

http://gwt-code-reviews.appspot.com/132817/diff/2001/20#newcode208
Line 208: layoutData.remove(i);
On 2010/01/22 11:30:32, andre.ruediger wrote:
Just curious: Shouldn't this be layoutData.remove(i--)? or better call
layoutData.iterator() and iterator.remove()?

Why not use a LinkedHashMap<Widget, LayoutData> for easy lookup of
LayoutData
instead of ArrayList<LayoutData>? The order of the keySet would be the
order of
the

It's not necessary to decrement i, because it's going to return
immediately. An iterator would work fine as well, of course.

I thought about using a map, but honestly it's just not worth the
trouble. The vast majority of the time, we'll have a small number of
children in each stack (<~10), and very few of them will be removed.
This does create O(n^2) behavior in clear(), but I just can't see N
getting large under any reasonable usage (if it did, you'd run out of
screen real estate rapidly).

http://gwt-code-reviews.appspot.com/132817/diff/2001/20#newcode213
Line 213: showWidget(layoutData.get(0).widget);
On 2010/01/22 11:30:32, andre.ruediger wrote:
Could we store the order in which the Panels where shown and show the
previously
displayed Panel? This would make even more sense in TabLayoutPanel,
though.

We could try to do something more complex like that, but I suspect that
any app that removes the currently-visible stack will have its own
specific behaviors it wants to enforce, so it's probably better to leave
it up to the app.

http://gwt-code-reviews.appspot.com/132817

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to