一步一步向上爬APACHE PIVOT篇之框架总览(Platform Overview)(二)

框架总览(Platform Overview)

[b][color=darkblue]译:像其它大多流行的开发框架一样,Pivot也提供了一套较综合,全面的基础类库,组成了一套框架.这些类形成的基石之上你可以任意构筑复杂、成熟的程序.[/color][/b]

Like most modern development platforms, Pivot provides a comprehensive set of foundation classes that together comprise a "framework". These classes form the building blocks upon which more complex and sophisticated applications can be built.

[b]Pivot类库主要分为以下几个大类(Pivot classes are grouped into the following primary categories):[/b]

Core - 一组常用的非UI类库(A set of common, non-UI classes).
WTK - 用于用户界面开发的类库,包括....等等(Classes for user interface development, including windows, dialogs, buttons, lists, text input, layout, drag and drop, etc).
Web - 用于帮助实现并与远程数据通讯的类库(Classes to facilitate implementation of and communication with remote data services.)
Charts - 用于为Pivot增加交互性-制图,图表分析能力Classes for adding interactive charting capabilities to Pivot applications.
在每个分类中的类被打包在与其名字对应的类库或者一组类库中(The classes in each category are packaged and distributed in a corresponding library or set of libraries):

[b]Core[/b]

pivot-core-[version].jar

org.apache.pivot.beans - 用于提升,简化与java bean类型的交互性的类(Classes that facilitate and simplify programmatic interaction with Java bean types).
org.apache.pivot.collections - 一组同时用于普通集合及UI组件的类/接口(A set of classes and interfaces that serve as generic collections as well as the data model for UI components).
org.apache.pivot.collections.adapter - 一组实现了集合接口/类的适配器帮助类(A set of collection implementations that are backed by java.util collections).
org.apache.pivot.collections.concurrent - 一组线程安全的集合实现类(A set of thread-safe collection implementations).
org.apache.pivot.collections.immutable - 一组只读的集合实现类(A set of read-only collection implementations).
org.apache.pivot.io - 与I/O操作相关的类(Classes related to input/output operations).
org.apache.pivot.json - 与JASON操作相关的类(Classes for working with JSON data).
org.apache.pivot.serialization - 用于数据序列化的类(Classes for use in data serialization).
org.apache.pivot.sql - 用于处理SQL的类(Classes for working with SQL data).
org.apache.pivot.text - 用于处理txt的类(Classes for working with text).
org.apache.pivot.util - 一些常用的工具类集合(A collection of common utility classes).
org.apache.pivot.util.concurrent - 用于简化后台任务执行的类(Classes to simplify the execution of background tasks).
org.apache.pivot.xml - 用于处理XML数据的类(Classes for working with XML data).

[b]WTK[/b]

pivot-wtk-[version].jar

org.apache.pivot.wtk - 用于定义WTK用户界面组件结构和行为的类(Classes that define the structure and behavior of WTK user interface components).
org.apache.pivot.wtk.content - 用于呈现组件数据的类,例如:列表或者表格的行(Classes representing component data, such as list items or table rows).
org.apache.pivot.wtk.effects - 用于支持一些视觉效果的类(Classes supporting visual effects such as blurs, reflections, and drop shadows).
org.apache.pivot.wtk.effects.easing - 用于产生缓冲操作的类,以产生自然感观的缓冲效果.基于Robert Penner开发的easing equations(Classes representing "easing" operations for producing natural-looking transitions. Based on easing equations developed by Robert Penner).
org.apache.pivot.wtk.media - 用于处理影音资源(Classes representing media resources).
org.apache.pivot.wtk.skin - 非独立的皮肤/视图,抽象基础类(Theme-independent skins and abstract base classes for theme-specific skins).
org.apache.pivot.wtk.text - 文本对象模型类(Text object model classes).
org.apache.pivot.wtk.text.validation - 用户输入信息验证类(Classes for validating user-entered text).
pivot-wtk-terra-[version].jar

org.apache.pivot.wtk.skin.terra - 定义用于默认'Terra'主题的皮肤/视图类(Defines skin classes for the default "Terra" theme).

[b]Web[/b]

pivot-web-[version].jar

org.apache.pivot.web - 用于与基于HTTP协议的web服务进行通讯的类(Classes for communicating with HTTP-based web services).
pivot-web-server-[version].jar

org.apache.pivot.web.server - 用于帮助访问及开发网页查询服务类(Classes to facilitate access to and development of web query services).

[b]Charts[/b]

pivot-charts-[version].jar

org.apache.pivot.charts - 一些用于制表,图表操作应用的类(A collection of components for use in charting applications).
org.apache.pivot.charts.content - 用于处理制表数据(Classes representing chart data).
大多Pivot的类放在WTK库中(Most of Pivot's classes live in the WTK libraries).

架构(Architecture)
[b][color=darkblue]
译:WTK的设计是基于当前的用户界面设计工具包广泛采用的 MVC:model-view-controller 结构.在WTK中, model层数据由定义在Core包里的一些常用集合接口产生(通常为 org.apache.pivot.collections.List and org.apache.pivot.collections.Map). 下一节将讨论到的组件代表Controller层,是介于model数据层与组件中'皮肤/视图'层,即MVC中的view层之间的中间层.[/color][/b]

The design of WTK is based on the model-view-controller architecture employed by many current user interface toolkits. In WTK, model data is represented by the generic collection interfaces defined in the Core library (most commonly org.apache.pivot.collections.List and org.apache.pivot.collections.Map). The component classes discussed in the next section represent the controller, which acts as the intermediary between the model data and the component's "skin", the MVC view.

[b][color=darkblue]译:皮肤层(或叫视图层)定义了组件的实际呈现效果, as a component has no inherent visual representation. 皮肤/视图层还定义了这类组件如何去响应用户输入操作,包括键盘和鼠标事件.组件可能有多个皮肤/视图(尽管只有一个皮肤/视图能够安装在任一组件实例上). 但是,现存的皮肤/视图对大多数开发者来说都是透明的, 因为皮肤/视图层并不公布任何公共的API. 所有与用户的交互都发生于视图组件中.
[/color][/b]
The skin defines the actual appearance of the component, as a component has no inherent visual representation. The skin also defines how the component responds to user input including keyboard and mouse events. Components may have multiple skins (though only a single skin can be installed on any component instance). However, the existence of the skin should be effectively transparent to most developers, as skins do not expose any public API. All interaction with the skin takes place via the skin's component.

[b][color=darkblue]译:视图层的组件可以添加"样式",风格类似于CSS中的样式. 通过这些组件,一个视图组件可以添加一组样式属性,例如"color" 和 "font" 等,用户可以通过设置这些属性来达到一个定制的程序外观,而无须再写一个新的视图. 默认的,所有的组件都使用由Terra感观定义的视图类.在这个包中的视图组件为我们在设置样式属性方面提供了足够的可伸缩性. 几乎Terra视图组件的所有外观,每个细节都可以通过样式属性来改变. Terra同时也提供了可由用户定制的颜色主题,以使设计人员可以很容易的为整个程序替换色调.[/color][/b]

Skins can be "styled" in a manner similar to CSS. Through the component, a skin may expose a set of style properties such as "color" and "font" that a user can change to achieve a custom application appearance without having to write a new skin. By default, all components use the skin classes defined by the Terra look and feel. The skins in this package provide considerable flexibility in setting style properties. Almost every aspect of a Terra skin's appearance can be varied via a style property. Terra also provides customizable "color schemes" that allow a designer to easily replace the color palette for an entire application.

[b][color=darkblue]译:一些组件的外观甚至可通过使用'renderers'来做深层次的定制, 通常用于一些 "轻量级组件" 来绘制一些组件. 例如,WTK按钮允许调用者定义一个renderer来绘制一个按钮的数据,以及列表视图支持用renderer来绘制列表元素.Renderers可以对大型集合数据直到有效替换,因为可以对内容进行类似橡皮图章的操作,而不是为每一个数据元素创建一个实际的元素实例,因为那样会耗费大量的内存和CPU时间.[/color][/b]

The appearance of some components can be further customized using "renderers", which are essentially "lightweight components" used to paint the content of the actual component. For example, WTK buttons allow a caller to define the renderer used to paint the button's data, and list views support customized painting of list items via a renderer. Renderers allow large collections of data to be presented very efficiently, as the renderer is used to "rubber stamp" the content, instead of creating an actual component instance for each data element, which would require more memory and processor time.

[b][color=darkblue]译:另外,使用renderers时, 组件内容将是一样的而不考虑正在应用的视图.这就确保了所呈现信息的一致性,无论你更新了视图或者发布了新的视图.[/color][/b]

Additionally, using renderers, component content is painted the same regardless of the skin that is currently applied. This allows applications to present information consistently as skins are updated or new skins are released.

[b][color=darkblue]译:Skins和renderers使用的是JAVA2D的API来绘制它们自身的组件. 关于JAVA 2D请参考: Java2D教程[/color][/b]

Skins and renderers use the Java2D API to draw themselves. See the Java2D Tutorial for more information on Java2D.
[b]未完,待续...[/b]

官方网址:[url]http://pivot.apache.org/tutorials/platform-overview.html[/url]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值