views:

92

answers:

0

I'm working on some GUI code in Groovy using SwingBuilder.

One of the elements on the screen is a JTable that's being used, essentially, as a properties editor. Groovy in Action has a fantastic example of how to do a display-only table, with what amounts to a side note that you can also attach a write closure. GiA's example is pretty consistant with the other examples I've found on the net: lots of read-only examples, not a lot of read-write examples.

I've got, basically, this:

table() {
  tableModel( list : editorData ) {
    closureColumn(header: 'Component Attribute', read: {it.attribute} )
    closureColumn(header: 'Value', read: {it.value}, write: { ?? }   )
  }
}

In a theoretical sense, I get what needs to be in the write closure: code that fires when the user edits that cell. But examples, like I said, are hard to come by, so I'm a little shaky on how that's actually supposed to work.

Can anyone point me at an example of using something like the above?