GWT Editors - temporary field

38 views
Skip to first unread message

Manuel

unread,
Mar 29, 2015, 11:21:56 AM3/29/15
to google-we...@googlegroups.com
Hi everyone,

my question is regarding the Editors framework with Requestfactor, that im qctually using.

I got a proxy with two dates, that is used with editors. Now I want to show the difference of these two dates in a seperate field (i.e. 2 hours).
One simple approach could be, after calling driver.edit(proxy), to calculate the diff for the dates manually.
Another could be, to add the diff-field to my proxy. Since the field is read-only + its a temporary field, that is not and should not be persisted, that wouldnt be the best solution I think.


Im not deep in editors, I just got the base Editors+Requestfactory example running. So my question is, whats the best / simplest way, to include a temporary non persitent field with editors?

Thanks in advance.

Regards,
Manuel

Thomas Broyer

unread,
Mar 29, 2015, 11:56:21 AM3/29/15
to google-we...@googlegroups.com
I would implement ValueAwareEditor on the editor that contains the subeditors for the two fields.
On setValue, compute the difference/duration and put it into a label for display (annotated with @Editor.Ignore, as it's not a field of the "model").

Manuel

unread,
Mar 29, 2015, 12:56:12 PM3/29/15
to google-we...@googlegroups.com
Hi Thomas,
thanks for the your help, using ValueAwareEditor works well.

Now I also want to update the diff field, whenever one of the date fields value changes.
onPropertyChange dont get called, after changing one of the datefields. I think I have to add valueChangeHandlers on the datefields to recognize changes on them to update the diff-field, or is there also some mechanism in the editors-framework for this?


Thanks in advance.

Regards,
Manuel


Thomas Broyer

unread,
Mar 29, 2015, 1:08:53 PM3/29/15
to google-we...@googlegroups.com


On Sunday, March 29, 2015 at 6:56:12 PM UTC+2, Manuel wrote:
Hi Thomas,
thanks for the your help, using ValueAwareEditor works well.

Now I also want to update the diff field, whenever one of the date fields value changes.
onPropertyChange dont get called, after changing one of the datefields. I think I have to add valueChangeHandlers on the datefields to recognize changes on them to update the diff-field, or is there also some mechanism in the editors-framework for this?

By design, the Editor framework doesn't listen for "live" changes, this is why you flush(). So yes, you have to register ValueChangeHandlers on the date fields yourself.
Reply all
Reply to author
Forward
0 new messages