I asked pretty much the same question:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/19b1600e34ca8f99#

I am in the same boat as you are.  I am trending toward just returning
a TextBox when it is really a TextBox I have in the view.  Will I
really need to change the TextBox with something else?  Sure maybe I
might add some other widget library's TextBox, but this is not really
a future concern, and regardless, re-factoring something like this in
an IDE by changing the interface is a 5-second operation.  It isn't
like this interface is widely used by the rest of the code base --
we're talking about coupling two classes here.

You can mock TextBox with EasyMock.createMock(TextBox.class), so
testing isn't a problem.

Regards,
Davis

On Aug 18, 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