Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 0.9.2-rc1
-
Fix Version/s: None
-
Component/s: plugins
-
Labels:None
-
Environment:Ubuntu 10.10, Groovy Version: 1.7.0 JVM: 1.6.0_24,
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
-
Patch Submitted:Yes
-
Number of attachments :
Description
Using the following in the view:
defaultWritableTableFormat(columns: [[name: 'name', editable: false], [name: 'value', editable: { a, b, c -> false}]])
works for the second column (i.e. it becomes read-only, as expected), but does not work for the first one.
I looked at the source code of griffon.glazedlists.gui.DefaultWritableTableFormat.DefaultWritableTableFormat, line 76:
columns.collect(queries) { columndef -> columndef.editable ?: query }
Given editable == false, the above will resolve to query, which defaults to IS_EDITABLE_STRATEGY closure, which in turn returns true when called, so the column is enabled regardless of the asBoolean in the isEditable method. I attached a quick patch (you should probably be able to make it more Groovy), though I guess the same should be done for isEditableStrategy, as per second patch. This would allow for:
defaultWritableTableFormat(columns: [[name: 'name', editable: false], [name: 'value', editable: { a, b, c -> true }]], editable: true)
This, of course, if this behavior is desired and if I had not misunderstood something. ![]()
Thanks for taking a look at this guys. I checked out revision 3698 - now it doesn't work when you don't specify anything for editable (i.e. you have to explicitly say editable: true to get the default set by IS_EDITABLE_STRATEGY). Sample patch attached.