我目前正在尝试使用Griffon 0.9.5和FlamingoBuilder创建应用程序。如何在Griffon中使用FlamingoBuilder创建功能区?
我中Application.groovy改变frameClass
价值'org.jvnet.flamingo.ribbon.JRibbonFrame'
并以带状添加到应用程序窗口试了几件事情。
我的第一次尝试是创建一个ribbonTask
节点嵌套ribbonBand
节点。应用程序启动但按钮不显示。
application(title: 'test01',
preferredSize: [320, 240],
pack: true,
locationByPlatform: true,
iconImage: imageIcon('/griffon-icon-48x48.png').image,
{
ribbonTask(title: 'Start') {
ribbonBand(id: 'fooBarBand', title: 'FooBar', image: imageIcon('/griffon-icon-48x48.png').image) {
commandButton(id: 'fooButton', text: 'Foo', image: imageIcon('/griffon-icon-48x48.png').image)
commandButton(id: 'barButton', text: 'Bar', image: imageIcon('/griffon-icon-48x48.png').image)
}
}
// add content here
label('Content Goes Here') // delete me
}
)
在我的第二次尝试我明确地创建一个RibbonTask
并调用addTask
。显示按钮。但是,我不确定这是否是Griffon的做事方式。 问题:有没有更好的方法来创建一个功能区?
application(title: 'test01',
preferredSize: [320, 240],
pack: true,
locationByPlatform: true,
iconImage: imageIcon('/griffon-icon-48x48.png').image,
{
ribbonBand(id: 'fooBarBand', title: 'FooBar', image: imageIcon('/griffon-icon-48x48.png').image) {
commandButton(id: 'fooButton', text: 'Foo', image: imageIcon('/griffon-icon-48x48.png').image)
commandButton(id: 'barButton', text: 'Bar', image: imageIcon('/griffon-icon-48x48.png').image)
}
current.ribbon.addTask new RibbonTask('Start', fooBarBand)
// add content here
label('Content Goes Here') // delete me
}
)
然后我尝试添加一个ribbonApplicationMenu
用下面的代码片段:
ribbonApplicationMenu(id: 'appMenu') {
ribbonApplicationMenuEntryPrimary(id: 'quitMenuEntry', text: 'Quit',
entryKind: JCommandButton.CommandButtonKind.ACTION_ONLY,
image: imageIcon('/griffon-icon-48x48.png').image)
}
但是,这是行不通的。我得到以下运行时异常:
了java.lang.RuntimeException:无法为 'ribbonApplicationMenuEntryPrimary' 理性创建组件: groovy.lang.MissingPropertyException:没有这样的属性:文本 类: griffon.builder .flamingo.factory.RibbonApplicationMenuEntryPrimaryFactory
的documentation of FlamingoBuilder状态,有一个text
属性,当我删除文本属性我得到一个异常,因为text
属性必须设置。我有点失落。这段代码有什么问题?
感谢您的解释。你打算从[Insubstancial 7.1](http://insubstantial.posterous.com/insubstantial-71-release)支持Flamingo吗?我已经提出了自己制作FlamingoBuilder的想法。 –
没错,Peacock(来自Insubstancial)就是要走的路。 FlamingoBuilder托管在https://github.com/griffon/flamingobuilder拉请求,欢迎:-) – aalmiray