I am trying to adhere to the MVP pattern. From what I understand, the
basic logic should be no widget code in the Presenter, so it's
testable without a GWT test case. And no app logic in the view, so
it's all contained and testable in the Presenter.

However, how do I in this case deal with adding widgets? I have a page
that shows buttons to each module in the system, based on whats
available and accessible by the user. Ie. the Presenter knows which
module buttons to display. However, without actually constructing any
widgets in the Presenter, and not putting any logic in the View, how
should I approach this?

Should the view have a factory method for creating widgets? I need
access to the interfaces HasText, HasClickHandlers,
HasMouseOutHandlers and HasMouseOverHandlers. There are classes that
have all these (Label is what I intend to use), but no shared
interface implementing all. Also, how should the widgets be added?
Should the View also expose a HasWidgets where I can add stuff? But
then I need the return to be an actual widget. Should I type this all
up using generics? But that turns into a lot off generic declerations.

Or am I just overengineering this? I do like having simple views with
logic without widget code. That way my Unit tests are fast. But it
seems I end up with a lot off classes and interfaces.

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