The General Interface MVC implementation means that the General Interface components are broken down into three architectural elements, each of which plays a crucial role in how the component behaves.
The General Interface MVC实现的意思是:General Interface组件分解3个架构元素,每一个在组件行为方面扮演重要角色。
The
Model maintains the state data for each object instance. For example, the model portion of the Matrix (
jsx3.gui.Matrix) object tracks state properties such as the number of columns, the widths of each column, the outer dimensions for the table, how to sort which column, and so on.
模型为每一个对象实例维护状态数据,例如:Matrix(jsx3.gui.Matrix)对象追踪状态属性,如列名、每列宽度、表格外边尺寸、每列是怎样保存的等等。
The
View refers to how the object instance is actually displayed on the client machine. A good way to envision a view is to think of object look-and-feel.
Figure 3 shows several different views that the Tab object can produce:
View涉及对象实例怎样实际显示到客户端的机制。一个好的关于视图的期望是只考虑对象的感官(look-and-feel)。 Figure3显示了几个Tab对象能够产生的视图。
The
Controller dictates how a given object will interact with events. Events include user-initiated events and system-initiated events, including mouse-clicks, key-presses, drag-and-drop operations, screen and component repainting, and calls from the application business logic.
Controller规定:一个给定的对象是如何与事件交互的,事件包括用户初始化事件和系统初始化事件、同时包含鼠标单击事件、键按下事件、拖放操作事件、屏幕和组件重绘时间、和应用程序逻辑调用。
How MVC Elements Work Together
Mvc各元素是如何工作在一块的。
The best way to describe how these three elements work together is to describe a typical GUI object, such as the Tab object, in context of these three elements.
最好的描述这几个元素是如何工作在一块的方法是去描述一个典型的GUI对象,例如Tab对象,在上下文中有3个对象
The easiest aspect of MVC to understand is the view. The view is what end users see when they use the application. The three Tab object instances shown in
Figure 4, for example, have a consistent view that adheres to the visual design for the application.
Mvc最容易理解的方面是view,view就是最终用户使用应用程序的时候看到的,树Tab对象实例在Figure4中显示,如例子,tab一块组成了应用程序的可视部分。
With the view element now defined, it’s easier to explain the model portion of the MVC architecture. The model element allows the given Tab object to keep an index of properties that uniquely define its state in memory (see
Table 1). The model is unaffected by how the tab visually displays its state. Instead, it maintains a single Boolean property,
active, that is set to true or false.
用当前定义的view元素,可以很容易理解mvc架构的model部分。model元素允许给Tab对象保持一个在内存中定义的唯一的索引属性,model不影响tab是如何显示他的状态。而model只是维护一个单独的Boolean属性(活动),可以设置成true或false;
From an architectural perspective, separating the model from the view means that more of the code base can be leveraged on future projects. Regardless of whether the view for a Tab object has beveled edges or graphical icons, the model remains the same. This means that only the view code for a given class needs to be updated from project to project.
从一个架构视图上分离model和view意思是,基础代码能够被功能功能项目平衡,不管Tab对象试图是否是一个有斜边或图标,model始终保持相同,这个意思是仅仅试图代码需要从一个项目到另一个项目时更新。
Table 1
Tab Object Models
The controller element updates the model based on events passed from the corresponding view. For example, a user clicks the displayed view for a Tab object in an attempt to bring the contents of that tab forward in the view. The view, in this case the actual HTML that is displayed, then processes the click event by calling the controller requesting that the selected tab be made active, and therefore brought forward in the view. Next, the controller queries the model to validate that the Tab object that was clicked is not already active. If the given Tab object is already active, the controller exits early without applying any changes to the object. However, if the Tab object is inactive, the controller updates the model by setting the active property to true. And then, the view is repainted in the browser to visually depict the new model value.
controller元素通过一个视图基于事件更新model,例如:一个用户为了看Tab前面tab的内容而点击一个Tab对象,View(实际上html已经显示了)依靠调用controller点击事件请求选中的tab去改变active,下一步controller要求model去检测点击的Tab对象是否是活动的,如果给的Tab对象已经是active,controller对对象不做任何改变的尽早推出,然而,如果Tab对象是inactive,controller把model的active属性设置成true,然后,view为描述新的model在浏览器中进行重绘。
In general, the model passes data to the corresponding view for rendering. The view then passes events to the controller for processing. This updates the model to reflect the property changes, providing a closed feedback loop.
通常,model为重绘传递数据到相应的view。view然后传递事件到controller进行处理,这更新model成对应的属性变化,提供了一个闭环反馈循环。
架构细节
Applications that leverage TIBCO General Interface run in a standard browser. No other software is required to run the application on a client machine. This means that the client application is completely native, allowing for stable, fast, and true thin client, zero-install applications. No applets, plug-ins, or ActiveX controls are required to deliver robust application functionality.
影响TIBCO GI运行在一个标准的浏览器上的应用程序,运行在客户端上的应用程序不需要其他任何的软件,这个意思是说,客户端应用程序完成的本地化、考虑到稳定、快速和真正的瘦客户端、零安装应用程序。没有applets、插件、或者ActiveX控件去表现丰富的应用程序功能。
To deliver high functionality in a standard browser environment, General Interface leverages many of the same principles that make server-side architectures successful. General Interface software is founded upon solid, object-oriented principles. This means that robustly scalable functionality requires only a minimal footprint of client memory and network bandwidth. The class libraries that underlie the software are lean, comprising over 400 logical functions in approximately 300KB of data. Due to the object-oriented architecture and object inheritance framework, over 2,200 function calls are actually available at runtime across more than 40 foundation objects. Furthermore, because the class libraries follow a consistent object-oriented structure, they can be modified as necessary by runtime updates, additions, and even sub-classing. In addition, new objects can also be built by combining foundation objects, all without increasing the overall framework size.
General Interface在一个单独的浏览器里面分离了高级功能,成功实现了很多和服务端功能相同的概念。General Interface软件稳固的、面向对象的概念上,这就是说、升级功能仅仅需要很少的客户端内存和网络带宽,偏向于基础的底层软件类库由400个逻辑功能组成,大约300kb的数据,由于面向对象的架构和对象继承框架作用,超过实际使用的2200功能包含在大约40个功能对象里面。此外、因为类库遵行一种面向对象框架结构,能够运行时更改、添加和甚至继承子类去完成符合需要的修改。另外,新对象能够通过组合对象创建,而这不会增加框架的大小。
To manage such a broad array of functionality, General Interface employs a multi-tiered approach to object design. Essentially, any available function can be categorized into four distinct layers, as illustrated in
Figure 5. These include:
●
|
Client logic layer This layer consists of all programmatic logic, such as business rules and client-specific functionality.
|
●
|
Presentation layer This layer is founded upon solid object oriented design principles that leverage many of the key concepts used by Java Swing, without the overhead of the Java Runtime Environment (JRE). A familiar Java-like syntax is used, generating complex HTML and JavaScript that runs natively in the browser, rather than Java class files that require the browser to load the memory-intensive JRE.
|
●
|
Data layer This layer is a client-side data cache used for quick access to application data. All data is cached as parsed XML and can be accessed at runtime through XSL queries. This is similar to the way SQL is used to interface with relational data stores on the server.
|
●
|
Communication layer This layer manages threaded communications with remote web servers using web service protocols such as SOAP and XML-RPC, as well as traditional web protocols like HTTP GET/POST.
|
为了管理如此宽泛的功能表,GI使用了一个分层的架构设计。实际上,任何功能都能够清晰的归类到4层机构中,如图5,这包括:
1.客户逻辑层:这层由程序逻辑组成,如商业逻辑、客户端特殊功能等。
2.展现层:这层建立在稳固的面向对象设计原理之上,借鉴了很多java swing的设计概念,但没有运行在jre之上,使用了类似java的语法,在原生的浏览器上实现了复杂的html和javascript,好于java类文件需要浏览器去加载jre到内存(applet)。
3.数据层:这一层是用户快速访问应用程序数据的客户端数据缓存,所有数据被解析成xml进行缓存,在运行时能够通过xsl从缓存里面查询出来,这非常想sql提供查询接口从数据库中查询数据。
4.通信层:这一层管理线程和远程web服务器进行通信问题,通信是通过web service协议进行如soap、xml-rpc、想传统的http get/post协议一样进行。
General Interface provides libraries of functional objects that hide the complexities of DHTML development. You do not need to be familiar with the specifics of HTML in a given browser and can focus instead on the actual business logic for the application. You write JavaScript to enforce business rules and workflow, not to move HTML around the screen. Accordingly, enterprises get more yield out of their development resources.
应用层:
General Interface提供了类库对象去隐藏复杂的DHTML开发,你不要需要熟悉不同浏览器的特殊HTML,只需把重点放到实际的应用程序商业逻辑上,写的javascript只表达商业规则和流程,不需要去围绕屏幕取移动html,因此企业更好的在现有的开发资源上提高收益。
General Interface employs a presentation approach similar to Java Swing but without the overhead of the Java Runtime Environment. Developers familiar with container-based GUIs will find similar constructs in the General Interface environment. Application components, screens, and widgets are constructed from General Interface GUI objects and saved as object sets that can be imported or exported at runtime to deliver incremental application functionality on demand. Accordingly, businesses can leverage the General Interface components out of the box or create libraries of their own reusable application components.
表现层:
General Interface使用了类似Java Swing的表示技术,但是不运行在Java Runtine Enviroment,在General Interface开发环境里开发者能够发现熟悉的gui组件,应用程序组件、界面小组件都已GI GUI对象构建,gui能够保存到对象集中,这些能够在运行时通过导入导出动态增加程序库的能力,遵循,能够自己创建可复用的应用程序组件。
General Interface provides customizable GUI components. Prototypes are available in the System folder of the Component Libraries palette as a starting point. From these components, you can create custom components.
从原始的组件库里,你可以更具需要定制自己的组件,
Note that different prototype objects can be instances of the same base class. For example, Text Box provides the base class for instances of a text box, a text area, and a password field. Similarly the
Block class is used as the base for Label and Image.
注意不同的原型对象能够实例化不同的原始对象,例如Text Box为a text box, a text area和 a 密码字段的实例提供基础类。 同样Block类被用于Label和Image的基础类。
General Interface GUI objects generate custom DHTML and JavaScript on the client. This design differs from traditional ASP or JSP architectures, where the presentation is generated on the server, and the resulting stream of HTML is returned to the browser for rendering. With General Interface, presentation generation doesn’t occur on the server. Therefore, transfer of presentation instructions over the network isn’t necessary. The result is highly responsive GUI applications that free up bandwidth for data (not HTML) and reduce the number of servers and server software licenses necessary to deliver a given application.
The client-side XML data cache provides you with a consistent API for data access and management. Benefits include:
●
|
Efficient data reuse
Multiple client objects within the presentation layer can use the same XML document for their source data, keeping redundant data transfer to a minimum.
|
●
|
Runtime data access Since server data is stored as XML, integrity is retained, allowing for DOM-based access to the original data.
|
●
|
Cache management methods A robust API allows you to write application-specific business rules that keep the client-side data synchronized with the server.
|
●
|
Client-side HTML generation With HTML generation on the client, server communications are unnecessary for presentation changes such as sorting and styling.
|
TIBCO General Interface uses a container-based model for visual components, similar to that of Java Swing and other object-based GUIs. Rather than treating a web application as a series of hyperlinked pages, this architecture provides true object modeling when building an application.
Container-based architectures have significant advantages, including:
●
|
Intelligent data refresh Specific containers can be targeted for updates while others remain untouched. Compared with refreshing an entire HTML page, less network bandwidth and CPU time is required.
|
●
|
Incremental functionality An application can import additional object sets only when required. The application initializes and responds faster because only a minimum object set is loaded. User actions can drive the loading of additional functionality. TIBCO General Interface Builder is an example of a robust application that loads functionality on demand.
|
●
|
Modular design paradigm The ability to work in a familiar, modular environment that is more efficient than HTML. High-level objects, such as Matrix and Dialog, take the place of
div and
span elements.
|
General Interface supports multiple protocols for communicating with services in the network. The basic supported interactions, which all function over HTTP/S, include:
Table 2
Supported Interactions
|
|
|
|
URL with Name-value pairs
|
|
|
|
|
|
URL with Name-Value Pairs
|
|
|
|
|
A key principle that drives the General Interface communication efficiency is to limit refresh to subsets of the screen, not the entire browser window. To facilitate this, General Interface improves and extends the traditional click-and-refresh APIs provided by the browser. Developers familiar with web application development have traditionally used standard approaches like HTML frames. Consider a standard web mail client, for example. To improve the user experience, the left frame persistently displays various folders and tools, while the right frame displays dynamic data. Although this design is adequate, there is no question that a web mail client is far less useable than an installed executable, such as Microsoft Outlook.
Technologies that provide single-page persistence in a web browser do exist, but these often leverage a client-side Java applet that requires loading the Java Runtime Environment into client memory or running a specific server platform. However, this design can quickly undermine application stability and available client-side memory.