Thursday, March 31, 2011

Re: Overriding panel's iterator() prevents clickHandler from being called.

Ah, I finally see what you are doing with that iterator. You are
using that to find and remove the item elements from the view.

What you are doing "wrong" is just abusing an existing method. You
generally try to not change the contracts of methods by overriding
them and assigning them different functionality, as it tends to break
existing code, and just be confusing.

There are many ways to do this kind of thing. The simplest would
probably be to define a new method "getItemElementsIterator" or
whatever else you want to call it, and return the flow panels iterator
that you want with that new method.


On Mar 30, 10:35 pm, Vhann3000 <> wrote:
> On Mar 30, 12:26 pm, Vhann3000 <> wrote:
> > Second, I may very well be wrong, but the way I understand it, if I
> > don't override the ScrollPanel's iterator(), then it will return the
> > VerticalPanel (as the VerticalPanel is the sole child widget of the
> > ScrollPanel). Of course, I don't want that, I want to be able to list
> > the VerticalPanel's child widgets with
> > scrollVerticalPanelInstance.iterator().
> I just tested and, indeed, if I don't override the iterator(), it just
> lists the
> nested Panel:
> public class ScrollFlowPanel extends ScrollPanel {
>         private FlowPanel fPanel;
>         public ScrollFlowPanel() {
>                 fPanel = new FlowPanel();
>                 super.add(fPanel);
>                 for (Iterator i = iterator(); i.hasNext(); ) {
>                         GWT.log("Widget class = " +;
>                 }
>         }
> }
> This code outputs:
> Widget class = class
> So how can I hide the nested Panels from the caller and still have my
> Handlers work?
> What am I doing wrong?
> Regards,
> Olivier

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment