简体   繁体   English

什么是应用程序控制器模式?

[英]What is an appcontroller pattern?

I'm learning gwt and I see there is an appcontroller pattern used in large projects that implement MVP. 我正在学习gwt,并且看到在实现MVP的大型项目中使用了appcontroller模式。 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 希望AppController和事件处理可以使您清楚了解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来协调UI组件之间的消息,并在每个presenter构建一个事件总线,以便AppController可以注册对演示者事件的兴趣并做出相应的反应。

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. 事件总线和rpcService一样具有全局性,它为演示者提供了异步回发调用功能。

It is in essence a presenter for the entire GWT-Application where the centralized management occurs. 本质上,它是发生集中管理的整个GWT应用程序的演示者。 (At least that is the way I have used it in my applications). (至少那是我在应用程序中使用它的方式)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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