Shouldn't ListEditor.setValue allow the replacement of a List property on an edited proxy?

43 views
Skip to first unread message

Tiago Rinck Caveden

unread,
Oct 24, 2011, 10:03:21 AM10/24/11
to google-we...@googlegroups.com
Hello all,

I have a GWT Editor to edit an entity proxy, and one of its properties, a List, is being edited by a ListEditor.
If the List already exists and all I have to do is change its content, then everything works as expected.
But when the list comes null and I have to create an instance to fill it, it doesn't work. After flush(), the proxy remains with its list null. I'm using ListEditor.setValue to set the new list instance.

Shouldn't this work?

Thank you,
--
Tiago Rinck Caveden

Patrick Julien

unread,
Oct 24, 2011, 11:37:58 AM10/24/11
to google-we...@googlegroups.com
No, you'll need to assign an empty list to your proxy before editing can begin if you're only using ListEditor

Tiago

unread,
Oct 24, 2011, 12:19:39 PM10/24/11
to Google Web Toolkit
Thanks for your answer.

But then I have to ask: what's the point of the method setValue in
ListEditor then?
If it's just a shortcut to getList().clear() followed by
getList().addAll(), shouldn't that be said in the javadoc? It isn't
written that I cannot redefine the instance...

Patrick Julien

unread,
Oct 24, 2011, 12:22:53 PM10/24/11
to google-we...@googlegroups.com
The setValue in ListEditor is actually coming in from ValueAwareEditor.  This is what the framework uses to setup the initial value of the editor based on what's in your proxy.


I usually find it's best to think of all editors in GWT has opaque instances of Editor.  That is,  no methods you can use directly.


Thomas Broyer

unread,
Oct 24, 2011, 12:24:35 PM10/24/11
to google-we...@googlegroups.com
setValue is part of the ValueAwareEditor interface. The "point" is that the Editor framework will call it when editing/displaying an object.

Tiago

unread,
Oct 24, 2011, 12:33:01 PM10/24/11
to Google Web Toolkit
Thank you, Patrick and Thomas.

Just for curiosity then - as for my case I can just set an empty list
before editing, no problem - what's the way to redefine the instance
of List property when using the Editor framework? Is there a way? At
least for non-list properties it normally works (I've used
SimpleEditor.setValue to do that, for example)

Patrick Julien

unread,
Oct 24, 2011, 12:35:13 PM10/24/11
to google-we...@googlegroups.com
You work with OptionalFieldEditor.

http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/editor/client/adapters/OptionalFieldEditor.html

This adapter can be used when a type being edited has an optional
field that may be nullified or reassigned as part of the editing
process

> --
> 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