An idea for an alternative solution which is more generic:

Form supports copyFrom & copyTo which accept a Map object
Maybe this could be implemented in FormTable as well (a list of maps then)

Your VO object sounds a lot like a map, maybe you could implement a
Map interface.

My 2 cents.
Christopher


2009/4/23 WarnerJan Veldhuis <[email protected]>:
> This is how I solved it for now:
>
> - I have overridden FormTable#onProcess() in my own AbstractFormTable
> class
> - Copied the entire contents of FormTable#onProcess()
> - In method onProcess() cast the column to my AbstractAttributeColumn
> - Ripped out the Ognl.setValue(...) part and replaced it with
> myColumn.setProperty(row, field)
> - implemented the setProperty() in various subclasses
>
> This has resulted in a very clean AbstractAttributeColumn which
> implements the methods getProperty(Object row) and setProperty(Object
> row, Field field). I can use the Field to get the Stirng value and parse
> it to fit my object.
>
> So yes, that would definately work for me. :)
>
> If I can do anything to help Click make more progress I'd be happy to
> offer my help.
>
> Cheers,
>
> WarnerJan
>
>
> On Thu, 2009-04-23 at 14:00 +0200, Bob Schellink wrote:
>> WarnerJan Veldhuis wrote:
>> >
>> > Now comes the anti-climax: when that form is submitted, there is no way
>> > to manually set the value for that field. Since the name of the Field
>> > will look like "SA_15", the Ognl lib will look for a property
>> > ModelObjectVO#setSA_15(Object) which is obviously not going to work,
>> > since the value needs to be set on the AttributeVO.
>> >
>> > I immediately wanted to override FieldColum#setValue(), but there was
>> > none :(.
>>
>>
>> Hmm to handle your use case it seems FieldColumn will need a new
>> method setProperty which by default uses OGNL to copy the value to the
>> Object. For more complex use cases it can then be overridden.
>>
>> Would that work for you?
>>
>> kind regards
>>
>> bob
>
>
>

<div><br></div>

Reply via email to