Issue 5752: ListEditor.setValue fails once the underlying AutoBean has been frozen

182 views
Skip to first unread message

Bálint Kriván

unread,
Jan 29, 2011, 12:19:45 PM1/29/11
to Google Web Toolkit
Hi!

I've just asked a question at issue: http://code.google.com/p/google-web-toolkit/issues/detail?id=5752#c6 Can somebody reply, so if I should wait for release or not?
Thanks!

--
Regards,
Bálint Kriván

Thomas Broyer

unread,
Jan 29, 2011, 3:30:22 PM1/29/11
to google-we...@googlegroups.com, Google Web Toolkit


On Saturday, January 29, 2011 6:19:45 PM UTC+1, Bálint Kriván wrote:
Hi!

I've just asked a question at issue: http://code.google.com/p/google-web-toolkit/issues/detail?id=5752#c6 Can somebody reply, so if I should wait for release or not?

Are you using a HasDataEditor to push your data to your CellTable? if so, given that HasDataEditor extends ListEditor, you're experiencing this bug. Otherwise, have you .edit()ed the MainProxy that you try to modify?

Bálint Kriván

unread,
Jan 29, 2011, 4:12:33 PM1/29/11
to google-we...@googlegroups.com
Yes, and yes :) I'm using HasDataEditor, because I don't know what else to use, and yes, I invoked edit() and it works for non CellTable data. So if I update to 2.2 RC1 (http://repo2.maven.org/maven2/com/google/gwt/gwt/2.2-rc1/), the bug should go away, right?

The other question: Is there a way to not to write custom FieldCustomizer for columns? Can't GWT know which proxy/property I am editing? Or am I doing something wrong? Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Üdv,
Kriván Bálint

Colin Alworth

unread,
Jan 29, 2011, 5:33:14 PM1/29/11
to google-we...@googlegroups.com
The other question: Is there a way to not to write custom FieldCustomizer for columns? Can't GWT know which proxy/property I am editing? Or am I doing something wrong? Thanks!

Assuming by FieldCustomizer you mean FieldUpdater... It seems not – the Column.getValue method must be implemented to load data and the FieldUpdater.update call to put it back again. I am trying to make a simple generator to turn an interface like

interface RouteColumns extends Columns<MyBean> {

@Header("Name")

@Editable()

EditTextCell name();

@Header("Description")

@Alignment(horizontal=HorizontalAlign.JUSTIFY)

TextCell description();

}

into a set of columns where the MyBean class has get/set calls for name and description. The Columns marker interface has a .configure call which goes through and adds each column in order to the CellTable.


It isn't perfect by any stretch, but it seems to fill a hole that code generation can solve. One remaining issue I would be interested in feedback on is how to i18n the header text. I've thought about requiring that the Constants interface this would use (probably indicated via an annotation to this type) have methods named the same as the methods in the interface...


Hope this sparks some thoughts in others – let me know if you are interested, and I will share a working version in the next few days.


-Colin

Colin Alworth

unread,
Jan 29, 2011, 5:36:47 PM1/29/11
to google-we...@googlegroups.com
On an unrelated note, the wysiwyg formatting options and copy/paste in the new google groups seem to be essentially useless, as indicated by the terrible display of code above... Apologies for sharing that terrible looking code segment..

-C

Bálint Kriván

unread,
Jan 29, 2011, 8:05:17 PM1/29/11
to google-we...@googlegroups.com
Yes, sorry :) I meant FieldUpdater. I will check your magic later thanks! But currently I'm still getting 
java.lang.IllegalStateException: The AutoBean has been frozen
:( I've updated to 2.2.0-M1, and I see that Thomas's patch is in. So I'm not sure, what's going on. The other fields can be edited correctly and saved to DB (so I guess .edit() and .flush() works correctly). But when I edit one cell of the CellTable, I get the exception. What am I doing wrong? I can send chunk of code if more needed, but currently I have no more idea, what can be wrong at my side. Thanks for your advice!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Üdv,
Kriván Bálint

Colin Alworth

unread,
Jan 30, 2011, 6:52:47 PM1/30/11
to google-we...@googlegroups.com
I don't fully understand the interactions between RequestFactory and the editor system, but it seems that there is another issue which is still causing this error to occur, though it seems to be another, unrelated bug, which only affects the HasDataEditor adapter and the editable HasData objects it wires in to the editor system. 

It appears that in AbstractEditorDelegate.initialize(String, T, E, DelegateMap), the object of type T has ensureMutable(T) called on it, and the value is passed then into setObject(T). It seems to be assumed then that the original parameter object is mutable, as it is passed into LeafValueEditor.setValue(T) at line 255. In the case of the CellTable, which is hooked into the editor framework using the HasDataEditor<T> class (whose IndexedEditor class implements LeafValueEditor), this means that the still-frozen instance has been drawn for the user, and so cannot be edited.

I'm still a little ways away from understanding a good fix for this, but it seems that AbstractEditorDelegate:255 could be changed to read leafValueEditor.setValue(getObject());. If that is the case, it seems likely that other similar changes should also be made nearby (lines 180, 182, and 280). 

All these line numbers are from the 2.2-M1 release.

Bálint Kriván

unread,
Jan 31, 2011, 8:04:21 AM1/31/11
to google-we...@googlegroups.com
Great, so I'm not the only one who is experiencing the issue, good to hear. Because I was starting to believe I'm doing something wrong. Should we open an issue for this?
--
Üdv,
Kriván Bálint

Eric Andresen

unread,
Feb 4, 2011, 11:48:20 AM2/4/11
to google-we...@googlegroups.com
We are seeing this issue as well.  Colin, did you try changing the AbstractEditorDelegate, and if so did you have any luck?   

Colin Alworth

unread,
Feb 4, 2011, 6:04:18 PM2/4/11
to google-we...@googlegroups.com
I did, in order to verify the fix, and have just filed an issue. http://code.google.com/p/google-web-toolkit/issues/detail?id=5981

The patch is below - it can be applied to 2.1.1 or 2.2.0-m1

Index: user/src/com/google/gwt/editor/client/impl/AbstractEditorDelegate.java
===================================================================
--- user/src/com/google/gwt/editor/client/impl/AbstractEditorDelegate.java (revision 9655)
+++ user/src/com/google/gwt/editor/client/impl/AbstractEditorDelegate.java (working copy)
@@ -177,9 +177,9 @@
   public void refresh(T object) {
     setObject(ensureMutable(object));
     if (leafValueEditor != null) {
-      leafValueEditor.setValue(object);
+      leafValueEditor.setValue(getObject());
     } else if (valueAwareEditor != null) {
-      valueAwareEditor.setValue(object);
+      valueAwareEditor.setValue(getObject());
     }
     refreshEditors();
   }
@@ -252,12 +252,12 @@
      * happened, only set the value and don't descend into any sub-Editors.
      */
     if (leafValueEditor != null) {
-      leafValueEditor.setValue(object);
+      leafValueEditor.setValue(getObject());
       return;
     }
 
     if (valueAwareEditor != null) {
-      valueAwareEditor.setValue(object);
+      valueAwareEditor.setValue(getObject());
     }
 
     if (object != null) {




On Fri, Feb 4, 2011 at 10:48 AM, Eric Andresen <erican...@gmail.com> wrote:
We are seeing this issue as well.  Colin, did you try changing the AbstractEditorDelegate, and if so did you have any luck?   

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Reply all
Reply to author
Forward
0 new messages