MVC模块化的GUI组件组件、MVC、GUI

2023-09-10 18:16:13 作者:承诺似雾如风

我想找到构建复杂的网页与MVC3和AJAX的方式。

I am trying to find the way to build complex web pages with MVC3 and AJAX.

我想用组件来实现这一目标。 每个组件包括了它自己的模型,视图和控制器。

I would like to use components to achieve this. Each component is consisted of it's own model, view and controller.

多个组件被放置在一些复杂的视图,并应共同采取行动, 提供期望的行为。

Multiple components are then placed on some complex view and should act together to provide desired behaviors.

在某些情况下,当用户执行某些操作(相互作用)与组分之一, 我必须通过AJAX更新页面的其他部分。 发生的动作(相互作用)有关组件,在它的实施方式中,不承担有关视图,并会被使用和什么页面的部分应该被更新,以及如何任何东西。

In some situations, when user performs some action (interaction) with one of the components, I must update other portions of the page via AJAX. Component on which action (interaction) occurred, in it's implementation, does not assume anything about view on which it will be used and what portions of the pages should be updated and how.

所以,当一些相互作用发生在一些组件,我需要一种机制(外部元件本身)将处理这种情况并更新页面的相应部分。 你将如何,通常,实施这样的机制?

So when some interaction occurs in some component, I need a mechanism (outside component itself) which will handle this situation and update appropriate parts of the page. How would you, generally, implement such mechanism?

推荐答案

我会使用调解模式,也有时会被误称为管理者模式

I would use the Mediator Pattern, also sometimes mistakenly referred to as the manager pattern.

这个类的调解组件的通信。

This class would mediate the communication of your components.