Probably not.
I'm no expert on this, but my intuition would say that if you want to have,
say, a telephone number entered then your registration view ought to add a
TelephoneNumber widget which would have the logic in it to validate
telephone numbers. You would then only need logic in the registration
presenter/controller to say thiungs like

if(phone.isValid())...

or

if(!phone.isEntered() || phone.isValid())...

or

if(!phone.isValid(country.getCountryCode())) phone.indicateInvalid()...

depending how complicated you want to get, and somewhere else

phone.getPhoneNumber()

if everything is OK

the registration presenter/controller can easily formulate the business
logic required for optional and required fields. It would be a lot simpler
than just having a whole load of text fields that the registration
presenter/controller had to validate everything in every way.

But I haven't really thought it through :-)

Ian

http://examples.roughian.com


2009/8/18 Dalla <[email protected]>

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