Griffon:执行JInternalFrame代码时出错

时间:2013-03-23 04:32:34

标签: groovy griffon

我最近只是在google搜索并希望尝试使用以下代码在Griffon 1.2.0中运行但是当我运行它时会给我这样的错误:

2013-03-23 12:13:01,877 [main] DEBUG griffon.plugins.i18n.I18nEnhancer - Enhancing org.codehaus.groovy.runtime.HandleMetaClass@b7ea5c[groovy.lang.ExpandoMetaClass@b7ea5c[class griffon.swing.SwingApplication]] with griffon.plugins.i18n.MessageSourceHolder@7b7bee
2013-03-23 12:13:01,909 [main] ERROR griffon.util.GriffonExceptionHandler - Uncaught Exception
groovy.lang.GroovyRuntimeException: Cannot add new method [getMessage] for arguments [[class java.lang.String, class java.util.Locale]]. It already exists!
    at griffon.plugins.i18n.I18nEnhancer.enhance(I18nEnhancer.groovy:34)
    at griffon.plugins.i18n.I18nEnhancer.enhance(I18nEnhancer.groovy)
    at griffon.plugins.i18n.I18nEnhancer$enhance.call(Unknown Source)
    at I18nSupportGriffonAddon.addonPostInit(I18nSupportGriffonAddon.groovy:40)
    at griffon.core.GriffonAddon$addonPostInit.call(Unknown Source)
    at griffon.core.GriffonAddon$addonPostInit.call(Unknown Source)
    at org.codehaus.griffon.runtime.util.AddonHelper$_handleAddonsAtStartup_closure3.doCall(AddonHelper.groovy:110)
    at org.codehaus.griffon.runtime.util.AddonHelper.handleAddonsAtStartup(AddonHelper.groovy:108)
    at org.codehaus.griffon.runtime.core.DefaultAddonManager.doInitialize(DefaultAddonManager.java:33)
    at org.codehaus.griffon.runtime.core.AbstractAddonManager.initialize(AbstractAddonManager.java:101)
    at org.codehaus.griffon.runtime.util.GriffonApplicationHelper.initializeAddonManager(GriffonApplicationHelper.java:394)
    at org.codehaus.griffon.runtime.util.GriffonApplicationHelper.prepare(GriffonApplicationHelper.java:149)
    at org.codehaus.griffon.runtime.core.AbstractGriffonApplication.initialize(AbstractGriffonApplication.java:231)
    at griffon.swing.AbstractSwingGriffonApplication.bootstrap(AbstractSwingGriffonApplication.java:75)
    at griffon.swing.AbstractSwingGriffonApplication.run(AbstractSwingGriffonApplication.java:132)
    at griffon.swing.SwingApplication.run(SwingApplication.java:45)
    at griffon.swing.SwingApplication.main(SwingApplication.java:37)
   [delete] Deleting directory G:\latihan\outer\staging\windows

这是代码,这最初是由aalmiray制作的

--- OuterController ---
package outer

class OuterController {
    def model
    def view
    def builder

    def newFrame = {
        String id = 'inner-' + System.currentTimeMillis()
        def (m, v, c) = createMVCGroup('inner', id, title: "Frame ${model.count++}")
        builder.desktopPane(view.desktop) {
            widget(v.innerFrame)
        }
    }
}

--- OuterModel ---
package outer

class OuterModel {
    int count = 1
}

--- OuterView ---
package outer

application(title: 'outer',
  preferredSize: [320, 240],
  pack: true,
  locationByPlatform:true,
  iconImage: imageIcon('/griffon-icon-48x48.png').image,
  iconImages: [imageIcon('/griffon-icon-48x48.png').image,
               imageIcon('/griffon-icon-32x32.png').image,
               imageIcon('/griffon-icon-16x16.png').image]) {
    borderLayout()
    button(newFrameAction, constraints: NORTH)
    desktopPane(id: 'desktop', constraints: CENTER)
}

--- InnerController ---
package outer

class InnerController {
    private String id
    def view

    void mvcGroupInit(Map args) {
        id = args.mvcName
    }

    void mvcGroupDestroy() {      
        execAsync {
            def desktop = view.innerFrame.parent
            desktop.remove view.innerFrame
            desktop.invalidate()
            desktop.repaint()
        }
    }

    def close = {
        destroyMVCGroup id
    }
}

--- InnerView ---
package outer

internalFrame(title: title, size: [200, 200], id: 'innerFrame',
    visible: true, iconifiable: true, maximizable: true,
    resizable: true, closable: true) {
    gridLayout(cols: 1, rows: 2)
    label 'Content goes here'
    button closeAction    
}

我需要你的帮助。

此致 亨德拉

1 个答案:

答案 0 :(得分:1)

Gievn错误消息我说你安装了i18n和i18n-support插件。自格里芬1.1.0以来,不再需要这些插件。卸载插件可以解决您的问题。

原因是这些插件提供的功能现在可以从1.1.0开始在Griffon核心中使用,因此这些插件会产生冲突。