you can do it in two ways: 1. Add a method to enable/disable the component in the interface ArrivalWidgetInterface. This solution makes sense if the enable/disable is a presenter responsability. 2. Extend TextBox setText to disable the component after a call.
I would recommend the first option. I think that you can use a HasValue<Boolean> interface to do it gracefully. Best regards, Eduardo S. Nunes On Tue, Aug 18, 2009 at 9:31 AM, Dalla<[email protected]> wrote: > > 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? > > > -- Eduardo S. Nunes http://e-nunes.com.br --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
