Reputation: 101
I have been following the GWT MVP tutorial (https://developers.google.com/web-toolkit/articles/mvp-architecture-2) and while it all makes a lot of sense, I have some trouble taking it from the example they explain to a larger scale application.
In particular, I would like to use a DockLayoutPanel to have a separate navigation, content and header section. What I'm struggling with is primarily the question of: where does the main dock panel live? Is it a view with it's own associated presenter? Does it constitute a special case where I don't want to use a view as this is really just the fundamental page layout?
It would be greatly appreciated to get some practical insights from people having faced a similar issue before.
Upvotes: 3
Views: 390
Reputation: 101
After searching for something related, I stumbled across another thread that asks a similar question and was quite insightful for me: GWT MVP - maintaining multiple displays that are separate of one another
Upvotes: 0
Reputation: 17489
Well I think as always it depends.
But I would recommend to create a View
(i.e. MainPageView) with it's own associated Presenter
(i.e. MainPagePresenter) even when there is almost no business logic and the View
only defines the layout of the application.
Maybe in the future there will be some business logic.
For example if you want to show alerts or notification popups to a user you will probably do this in this View
.
So your MainPagePresenter
will listen for Notification events on the global EventBus
and once an event is fired from any nested Presenter
it will display a notification popup in the MainPageView
.
Another use case would be if you want to display breadcrumbs in the north panel.
Of course you could create a separate Presenter
for breadcrumbs but IMHO that's too much overengineering. You could however easily do that in the MainPagePresenter
I am using GWTP as my MVP framework and there it is really trivial to create View/Presenter pairs and it also supports nested PresenterWidgets
which you can for example embed in any panel of your DockLayoutPanel
Upvotes: 1