The MVC architecture is based on the existence of only a single model and does not
specify how different models should be organized within an application.JGadgets ex-
tends the MVC paradigm by introducing a controller hierarchy that administers the
models and the interactions between them.
MVC体系结构是基于只存在一个模型,而不规定在一个应用中应该如何组织不同的模型.JGadgets通过引入一个控制器分层结构扩展了MVC的范例,该分层结构用来管理模型和模型之间的相互作用.
MVC fosters a transparent reuse of model components independently of their visual
representation:a typical model element is a list box with the associated buttons for add-
ing,modifying and deleting list items as well as an editor dialog for editing them [8].
The logic of the list box (list handling,buttons) is quite simple and thus can be easily
reused.The view of the list box,however,can vary significantly:the list view could be a
single- or multi-column list or a combo box; the buttons could be right aligned or bot-
tom aligned.A button could be left out or exist twice,and so on.By separating model MVC-based Architecture for e-commerce.Journal.doc 4/22 and view a developer can reuse the (black box) model component but is not restricted to use a certain view template.Analogously,view and controller components can be de-fined.Due to the model hierarchy of JGadgets reusing of model components gets even simpler.
MVC培育了模型成分独立于它们的可视表示方法的透明重新使用:一个典型的模型元素是一个列表框,其带有相关的按钮用于添加、修改和删除表单项,以及为编辑它们与编辑者的对话[8].列表框的逻辑(表单处理,按钮)十分简单,因此可以容易地重新使用.可是,列表框的视图可以明显改变:表单视图可以是单列的或多列的表单,或者是一个组合框;按钮可以是右对齐的或底部对齐的.一个按钮可以是略去的,或是存在两次的,等等.通过分离模型和视图,一个开发者可以重新使用(黑匣子)模型成分,但是并不限于使用一个一定的视图模板.类似地,视图和控制器成分可以被规定.由于JGadgets的模型分层结构,所以模型成分的重新使用变得更简单了.
In summary,the important aspects of JGadgets are the automated linking mechanism
between models and views,the generic controller and the scalability of these compo-
nents.
总的来说,JGadgets的重要方面是模型和视图之间的自动联动机理,总的控制器,以及这些成分的可量测性.
The next section presents the features and usages of JGadgets from a developer's
perspective.A discussion of the core design aspects of the framework is presented in
Section 3.We assume that the reader is familiar with the core concepts of object-
oriented frameworks as described in [9,10,11].
下一节从开发者的角度介绍JGadgets的特点和使用.对架构核心设计方面的讨论在第三节中介绍.我们假设读者对文献[9-11]中描述的面向对象的架构的核心概念已很熟悉.
2 Reduced Development Effort Through Model-View Separation—A
Case Study
2 通过模型-视图分离减轻开发努力——案例研究
The sample dialog (see fig.2),which shows the authentic German labeling,allows end
users to retrieve information about a bank customer.The tab control supports the selec-
tion of various search criteria such as name,personal identification number,account
number,and telephone number.In case of a name-based search,the end user enters the
last name (text field labeled Name/Bezeichnung),and/or the first name (text field la-
beled Vorname) and/or the date of birth or date when the company started its operation
(text field labeled Geb./Grün.Dat.).After pressing the Search (Suchen) button,the list
in the lower half of the dialog displays the search results,in this search example cus-
tomers with the last name Schwarzenegger.
显示正宗德国标记的样本对话(见图2)让最终用户能检索有关一家银行用户的信息.选项卡控件支持各种不同搜索判据,例如名字、个人身份证号、帐号、以及电话号码的选择.在基于名字的搜索的情况下,当公司开始其运行时(文本字段标志Geb./Grün.Dat.),最终用户输入姓氏(文本字段标志姓/ Bezeichnung)和/或名(文本字段标志Vorname)和/或出生日期.在按下搜索(Suchen)按钮之后,在对话下半部分的表单就显示搜索结果,在这一搜索例子中,就是姓Schwarzenegger的用户.
In order to display or modify the detailed information associated with the customer se-
lected in the list,the end user presses the Modify (Ändern) button.This opens another
dialog where the corresponding data can be edited (see fig.3)
为了显示或修改与用户在表单中选择的相关的详细信息,最终用户可按下Modify(Ändern,修改)按钮.这样就打开了另一次对话,其中对应的数据可以进行编辑(见图3).