I need to put some display-only fields on my form that are calculated from user input and domain data. I want the calculated fields to be "bound", in the sense that they should get the usual converters, binder/binding, interceptors, etc, even though there are no corresponding properties on the domain objects. Also, when I set them, the form should not get "dirty".
What's the right way to make a ValueModel for these fields?
I read in another thread (which I cannot seem to find now), that these fields should be in "another" form model. Ok, I created a separate form model and an object for it to introspect (fine so far), but then it was a mess getting them bound (had to create another binding factory), and put into the TableFormBuilder (add(Binding); gets assertion failure). So I copied the code that adds the label+gap+bound component to the layout. Then when a valueChangeListener fires, I set a new instance of my "bean" into the separate form model.
It seems to work fine, but it's quite a bit uglier than I expected, specifically in the binding and form building parts. The extra "bean", listening on value model edits, and replacing the bean is all very nice. But I must be off-track if it is so hard to get a bound component layed out, right?
Thanks,
--kerry


Reply With Quote
But your response to hammer's question is right on.
