在MVC中,与应用程序模型相对的GUI模型是什么? [英] In MVC what is a GUI model in opposition to Application model?

查看:77
本文介绍了在MVC中,与应用程序模型相对的GUI模型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发Java Swing MVC应用程序时,与应用程序模型相对的GUI模型是什么?为何与MVC相关?

When developing Java Swing MVC apps, what is a GUI model in opposition to an Application Model? And why is it relevant to MVC?

我阅读了有关示例此处此处.同样在 GUI-部分的 Swing体系结构概述中.状态与应用程序数据模型.

I read about it the example here (the example does not use a GUI model though). Found more information about it here, here and here. Also in A Swing Architecture Overview in the section GUI-state vs. application-data models.

引用示例的作者:

最后,这就是我在Java Swing中实现模型/视图/控制器模式(MVC)的方式.

Finally, this is how I implement the model / view / controller pattern (MVC) in Java Swing.

该视图可能会从模型中读取值.该视图可能不会更改模型中的值.

The view may read values from the model. The view may not change values in the model.

控制器将(可能)更改模型中的值.

The controller will (probably) change values in the model.

控制器将(可能)导致视图重新绘制.

The controller will (probably) cause the view to repaint.

通常我没有一个主控制器.我让每个控制器都做自己的事.

I don’t have one master controller, usually. I let each controller do its thing.

我通常只有一个大师模型.有时,您需要多个GUI模型.这不是其中一次.如果您的GUI是更大的Java应用程序的一部分,则GUI模型通常与应用程序模型分开.

I do usually have one master model. Sometimes, you need more than one GUI model. This isn’t one of those times. The GUI model is usually separate from the application model, when your GUI is part of a much larger Java application.

推荐答案

关键在于缩写"MVC",即模型视图控件".符合MVC原理的应用程序从视图(管理图形用户界面的代码-简称GUI)的视图(从管理数据的逻辑)到控件(管理业务数据的逻辑)之间区分数据模型(业务数据).

The key lies in the abbreviation 'MVC' which means Model View Control. An application that complies with the MVC principle differentiates the data model (business data) from the control (the logic managing the business data) from the view (the code managing the graphical user interface - or GUI for short).

因此,GUI模型是UI的模型,而应用程序模型是并非特定于MCV模型的一部分的模型.从理论上讲,它可以覆盖整个应用程序.也许值得一提的是,我将单词模型与描述性表示同义使用,例如在类模型或控制流程图中.但是模型在其他情况下可能意味着更多.例如,组合的业务类集也可以称为业务模型,而应用程序中的组合类可以称为应用程序模型.

Thus a GUI model is a model of the UI, while an application model is a model not specific to a portion of the MCV model. It could theoretically cover the entire application. It is maybe worth mentioning, that I use the word model synonymously with descriptive representation, as in a class model, or a control flow chart. But model can mean more in other contexts. For example the combined set of business classes can also be called the business model, while the combined classes in an application could be called the application model.

这篇关于在MVC中,与应用程序模型相对的GUI模型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆