You have to decide on the granularity you want.  I found it easier to
use an interface that would give me the actual widget in my presenter,
and then the presenter can do several things on each widget as it
needs.

I am using the widget's class in the interface, since I am using
SmartGWT widgets it seemed easier that way.  I kept switching back and
forth between different widgets that had different "Has Click
Handlers" types of interfaces. (the kind for Forms and the regular
kind)

So I may only pass back 4-5 widgets for a simple login widget.  Also
one of the widgets I modify through a setter in the view, which is
also defined in the interface given to the presenter.  One setter in a
view of my app is a "SetStatusText(String text)", so the presenter can
update as it the RPC is going on.  I'm still trying to find a
consistent approach that is easiest to manage.




On Tue, Aug 18, 2009 at 3:10 PM, Dalla<[email protected]> wrote:
>
> Eventually, I solved it like you suggested.
>
> I can see why this is good, as it will be decoupling the presenter
> from the view.
> However, it seems a bit "bulky". Let´s say I want to be able to set a
> style aswell,
> add a KeyPressHandler, add a ValueChangeHandler and so on,
> and that I have 10 or more textboxes in the same widget,
> for example in a widget for user registration requering details about
> address, phone number, email and so on.
> I would probably end up with an interface with more than 50 methods...
>
> Would this still be the way to go?
>
>
>
> On 18 Aug, 14:10, Ian Bambury <[email protected]> wrote:
>> How about
>> void setEnabled(boolean enabled);
>> It's really up to the view how it indicates whether something is disabled or
>> not. Different views for the same interface might do different things.
>>
>> Ian
>>
>> http://examples.roughian.com
>>
>> 2009/8/18 Dalla <[email protected]>
>>
>>
>>
>>
>>
>> > Hi all
>>
>> > A design question for everyone using MVP for their GWT
>> > implementations :-)
>>
>> > I have a simple interface like so:
>>
>> > interface ArrivalWidgetInterface {
>> >            ....
>> >            HasText getSlotText();
>> >            ....
>> > }
>>
>> > Let´s say that I want to set the SlotText in my widget implementing
>> > the above interface.
>> > I´m leaving some code out here, but it should be pretty straight
>> > forward if you have been using
>> > examples from Google IO 2009 and so on.
>>
>> > Pretty simple, in a async success method I put the following:
>> > widget.getSlotText().setText(result.getSlot());
>>
>> > Done.
>>
>> > Let´s say now that I want to manipulate the Slot textbox in some other
>> > way,
>> > for example disable it after the value has been set.
>> > How can I do this in a good way?
>>
>> > Changing the interface to return an TextBox instead of the HasText
>> > interface seems like a bad idea,
>> > since that would give me problems when testing. If possible you´ll
>> > want to keep all the UI-code outside the presenter, right? So what
>> > would be best here? Create a new public method in the widget, and
>> > expose that method in the interface aswell?
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to