Java Swing 開發框架,Griffon 2.1.0 發布

jopen 9年前發布 | 16K 次閱讀 Griffon

Griffon 是Swing開發者的一個Groovy框架。Griffon期望提供一個穩定代碼結構給Swing應用,就像Grails給web開發帶來的優勢一樣。同 時,Griffon也可能提供一個替代應用框架,替代Spring RCP,Eclipse RCP和NetBeans平臺。

Griffon 2.1.0 發布,主要改進如下:

 * MVC 組管理改革
 * 使用 ActionHandlers,Actions 可以在任意時間更新他們的屬性
 * 啟動組可以提供插件
 * 更新了 Lazybones 項目模板
 * 更新了構建時和運行時依賴

griffon-banner-large.png
詳細內容如下:

Griffon 2.1.0 Release Notes

Dependencies

The following dependencies have been upgraded

  • junit:junit:4.12

  • org.codehaus.groovy:groovy-all:2.3.8

  • com.jayway.awaitility:awaitility:1.6.3

  • com.jayway.awaitility:awaitility-groovy:1.6.3

Runtime

MVC

In previous versions instances of MVCGroup would let you create other MVCGroup instances, with no direct relationship between the two unless explicitly stated (via an additional argument Map). This is no longer the case.

Child groups may now have a direct relationship with the parent group that created them. The parentGroup property will be set to the correct MVCGroup instance in every group member that defines it. Fine grained parent properties matching each member (such as parentController, parentModel andparentView) will also be set automatically. There are 2 sample applications that demonstrate this new feature in action

MVCGroupManager added getter/finder methods for Controllers, Models and Views. Finder methods may return a null value if the matching artifact was not found. Getter methods on the other hand will throw a ArtifactNotFoundException if the artifact could not be found.

The MVCHandler interface has been altered to better handle MVCGroups. Methods that sport MVCGroup in their name work with instances (createMVCGroup and withMCGroup) ofMVCGroup, either they take such type as argument or return instances of it. In contrast, methods that only have MVC on their names (createMVC and withMC) work with individual MVC members, such as Controller, Model and View. The following table summarizes the changes

Old Name New Name Return Type Args

buildMVCGroup

createMVCGroup

MVCGroup


createMVCGroup

createMVC

List


withMVCGroup

withMVCGroup

void

MVCGroupFunction

withMVCGroup

withMVC

void

MVCFunction

Finally, base artifacts such as Services can no longer create new MVCGroups by themselves, as this capability has been removed from the base GriffonArtifact interface.

Actions

The ActionHandler interface supersedesActionInterceptor interface, as it delivers a much better abstraction for configuring, handling and updating actions an their properties.ActionManager also gained the capability to update an action or a set of actions.

Addons

GriffonAddons now have the capability of supplying startup groups. These groups are initialized during the STARTUP phase, right after the startup groups defined by the application.

Buildtime

Types Metadata

The java.util.ServiceLoader class allows you to load instances of a particular type as long as it conforms to the following rules

  1. the type implements a well known interface.

  2. the type is a concrete class.

  3. the type is a public, non-static class.

  4. the type provides a no-args constructor.

However sometimes you’d need to load types in a similar fashion without being forced by the last 3 rules, that is, you may want to load a type that is an interface or that provides a constructor with one or more arguments. If you ever encounter this scenario then annotate the classes/interfaces with @TypeProviderFor and load them using ServiceLoaderUtils. For example the griffon-mybatis-plugin loads instances ofMybatisMapper using this mechanism.

Compatibility

Full binary compatibility report between Griffon 2.0.0 and 2.1.0 can be foundhere.

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!