简体   繁体   中英

What is an appcontroller pattern?

I'm learning gwt and I see there is an appcontroller pattern used in large projects that implement MVP. I have read through the official docs. But they seem to be very context specific and abstract. I want to understand the pattern as a whole and the motivation behind it. Any help would be much appreciated. Thank you.

Hope AppController and Event Handling makes you clear about AppController

To address the dependency issues, we'll introduce an AppController to coordinate messages between UI Components and we'll build an Event Bus in to each presenter so that the AppController can register interest in the presenter events and can react accordingly.

AppController的

The application controller is exactly what the name states.

It is what controls the app-wide events.

For example this is where the history events are taking place. When someone browses the app and a new main view comes into place or when you press the back or forward button of the application this is where the you control how this is done. This is where you will create most of the major presenters and views and add them or remove them from the application.

Another example are the global data. If there are data shared between the views this could be the place where you would put them and update them according to the user input so that when another presenter would have need of them, they would know where they are. The event bus is such a global as well as the rpcService that provides the presenters with the async postback call capabilities.

It is in essence a presenter for the entire GWT-Application where the centralized management occurs. (At least that is the way I have used it in my applications).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM