My ListBox is inside a custom composite widget I have created. I am using this widget in my different views in my application.
Just to elaborate more on this widget which I created, it is a Dialog Box which has Left ListBox and Right ListBox. There are 4 buttons on the center which allows to move items from Left to Right or Right to Left. They can be moved one at a time or all at once. So when I created this ListBox using GWT Designer as a New-Windows Builder- UIBinder - DialogBox I don't get any presenter or activity with that. Plus I don't want an activity simply because I don't want a new place. I am opening this custom dialog box within my same place and I don't want to write the processing code of moving items from either side inside my current activity because then If my two different views want to use this custom dialog box I have to duplicate the code. The whole idea of this Widget was to have self-contained code. The problem I see with GWT designer is all the event handling code goes inside UIHandler method which is still inside my CustomWidget.java file. How do I then test my widget not inside GWTTestcase? I introduced a presenter to use classic MVP approach and move my processing logic inside presenter that way I can test my presenter my mocking GWT widgets as my own custom widgets. MVP-Part 2 deals with Activities and Places which works fine when you are using GWT widgets inside a View. But when you have a re-usable widget you created I don't want to assign new place and activity for every custom widget I create. Because I really want to test my widget and not the view here. See the difference here? Unless I am missing something here.. On Sep 1, 11:40 am, Thomas Broyer <[email protected]> wrote: > I'd highly encourage you to use the pattern from the "MVP - part 2" article > from the GWT doc, where the presenter itself implements an interface that > the view calls back, rather than exposing the view through HasXxxHandlers > and the like. It makes mocking so much painful! (having to mock > HasXxxHandlers is a PITA compared to simply mocking your View interface, and > capturing the presenter from the setPresenter method so you can call methods > on it as if the view did it). > > To answer your question, your view should expose the methods you use from > the ListBox (and simply delegate them to the listbox); you shouldn't try to > expose "the listbox" as an object from your view (because as you said, > there's no "matching" interface). So you'll add those 7 methods to your view > (possibly using a naming scheme such as getAdmin, setAdmin, etc.). > Also, instead of a ListBox, you could use a ValueListBox so you can directly > "push" your "model" to your view, and get the selected object back from the > view. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
