Further Experiments with Griffon

Another small experiment with Griffon, but this time there's a problem, one that I've had a couple of times. First, the code. Here's the model:

import groovy.beans.Bindable

class App1Model {

    @Bindable String name = "James"

}

Here's the controller:

class App1Controller {

    def model
    def view

    def saveName = { evt ->
        model.name = view.nameField.text
    }

}

Here's the view:

build(App1Actions)

application(title: 'App1', size:[320,480],
    location:[50,50], pack:true, locationByPlatform:true) {

    panel(border:emptyBorder(6)) {
        borderLayout()
        hbox(constraints:NORTH) {
            label(text:"Name:")
            hstrut(5)
            textField(id:"nameField",columns:20,"Tom")
            hstrut(5)
            button(action: saveName)
        }
        hbox(constraints:SOUTH) {
            label(text: "Hello ")
            label(text: bind{model.name})
        }
    }

}

And here's the "App1Actions" that's referred to above:

actions {

    action( id: 'saveName',
        name: "Save",
        closure: controller.saveName,
        accelerator: shortcut('S'),
        mnemonic: 'S',
        shortDescription: "Save the entered name",
    )

}

Couldn't be much simpler than that. The text in the label is bound to the domain 'name', which changes when the Save button is clicked. I then deployed both the Swing application and the applet (which, for fun, I dragged out of the browser):

But there's a problem. The Swing application works as expected. But the applet only works the first time the Save button is clicked, after that not at all. Possibly there's a threading issue? Or an initialization issue? I didn't use any of the lifecycle classes. Maybe that's why? Anyway, I'm stumped.

Comments:

Sounds like a bug we need to look at. The jira bus ssytem for Grifofn is up: http://jira.codehaus.org/browse/GRIFFON so you can have the pleasure of posting the first issue.

Posted by Danno Ferrin on September 17, 2008 at 07:51 AM PDT #

Hurray, the first bug report for Griffon:
http://jira.codehaus.org/browse/GRIFFON-1

Posted by Geertjan on September 17, 2008 at 09:22 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today