如何在遗留 Java 应用程序中将现有的 Swing UI 模块替换为基于 Griffon 的模块?
我想要修改的应用程序组织得很好。 UI被分成一个模块。 UI 控制器实现PropertyChangeListener 接口。当其他模块想要在 UI 中发生某些事情时,它们只是在 UI 控制器上触发 PropertyChangeEvents
,而不知道它们背后的内容。注入的PropertyChangeListener的当前实现可以很容易地替换为实现相同接口的Griffon控制器。
从 Groovy 调用 Java 方法并不是什么大问题,因此从 UI 到应用程序其余部分的通信应该也不是什么大问题。
是否有任何将 Swing 编写的 UI 模块移植到 Griffon 框架的教程或书面经验?
The application that I would like to revamp is pretty well organized. UI is separated into a module. UI controllers implement the interface PropertyChangeListener
. When other modules want to have something happened in the UI they just fire PropertyChangeEvents
on UI controllers not being aware what is behind them. Current implementations of injected PropertyChangeListener
s could be easily replaced with Griffon controllers implementing the same interface.
Calling Java methods from Groovy is not a big deal so the communication from UI to the rest of the application shouldn't be a big deal.
Are there any tutorials or written down experiences with porting UI modules written in Swing to Griffon framework?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,我认为没有任何东西可以从传统的 Java Swing 过渡到 Griffon。我去年做的一个项目也处于类似的状态。在 SpringOne2GX 会议上,我向 Griffon 作者询问了如何在遗留 Swing 应用程序中使用 Griffon。他们表示,不幸的是,Griffon 目前仅适用于绿地应用。这是他们希望达到的目标,但据我所知仍然不可能。这是截至 2009 年 9 月的情况。
您也许可以做一些事情,但我认为您将是编写有关如何执行此操作的教程的人。
Unfortunately I don't think there is anything for going from legacy Java Swing to Griffon. A project I was working on last year was in a similar state. At the SpringOne2GX conference I asked the Griffon authors about using Griffon from a legacy Swing application. They said that right now unfortunately Griffon was for greenfield applications only. This is something they hoped to get to but to my knowledge is still not possible. This was as of September 2009.
You might be able to get something to work but I think you would be the one writing the tutorial on how to do this.
在即将推出的 Griffon 0.9.1 中,您可以使用纯 Java 编写模型/视图/控制器工件。
因此,也许将您的应用程序移植到 Griffon 是一个很好的起点。
在此处查看详细信息 http://docs.codehaus.org /display/GRIFFON/Griffon+0.9.1#Griffon0.9.1-NonGroovyArtifacts
In the upcoming Griffon 0.9.1 you can write model/view/controller artifacts with pure Java.
So, maybe it will be a good start point to port your application to Griffon.
Check out details here http://docs.codehaus.org/display/GRIFFON/Griffon+0.9.1#Griffon0.9.1-NonGroovyArtifacts