Thursday, March 31, 2011

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

Correct. You weren't abusing the iterator itself, you were abusing
the iterator method, which other things used.

You can still extend ScrollPanel, but just add your own bit of
interface on top of it. Like this bit of pseudocode.

class MyScrollPanel extends ScrollPanel {

private FlowPanel mySecretFlowPanel;

public void addThing(Thing x) { //add things to secret flow panel
here }

public void removeThing(Thing x) { //you get the idea }

public Iterator<Thing> getThingIterator() { return
mySecretFlowPanel.iterator(); }

}

This is all a very view-centric way of doing it, however. I might
suggest reading up on the MVP pattern, which would help abstract away
the details of the panels entirely.

-Ben

On Mar 31, 12:02 pm, Vhann3000 <vhann3...@gmail.com> wrote:
> On Mar 31, 11:53 am, Vhann3000 <vhann3...@gmail.com> wrote:> 2- When the Button gets clicked, it should call the ItemClickHandler
> > (but it does not if and only the overriden iterator() is not there).
>
> I meant it doesn't work when I override iterator().
>
> Now, from what I understand, GWT relies on being to walk through the
> panel tree using iterators() and that means I can't "hide" a panel
> like that
> (hence why it fails).
>
> If I'm correct, then what are my options? Obviously, I can't use
> ScrollPanel
> because it implements the "HasOneWidget" interface. But then, if I
> don't
> extend ScrollPanel, how can I implement HasScrollHandlers: to do that,
> I must implement addScrollHandler() which returns a
> HandlerRegistration.
> The problem is that, as far as I know, HandlerRegistration can only be
> returned by
> HandlerManager and its subclasses (DefaultHandlerManager) yet these
> are deprecated
> with no replacement :s .
>
> 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 google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment