You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Bob Schellink <sa...@gmail.com> on 2009/05/10 11:18:42 UTC
Re: FormTable and CayenneForm
Hi Stefan,
Stefan Klein wrote:
>
> I wanted to use a FormTable with an CayenneForm, using getDataObject().get/toManyRelationShip/() to set the rowlist of the FormTable.
> getDataObject() tries to construct the dataobject by using the oidField which holds the primary key. Well, the oidField only holds the primary key after it is proccessed. So to get the column fields of the FormTable get processed it needs to have it's rows filled befor onProcess, but i only get the row list after onProcess (if i am using the suplied getter).
>
> Should i read the value of FO_ID on my own, construct the dataobject and use setDataObject to set it or is there a cleaner/better way to solve this?
You are right, you need to ensure the oidField contains its value
*before* onProcess in order to populate the FormTable.
You could encapsulate this "early binding" with a custom CayenneForm
so that the oidField and classField values are available before
onProcess. For example:
public class MyCayenneForm extends CayenneForm {
public MyCayenneForm(String name) {
super(name);
// Bind the oidField and classField to request parameters
oidField.bindRequestValue();
classField.bindRequestValue();
}
}
Hope this helps.
kind regards
bob
Re: FormTable and CayenneForm
Posted by Stefan Klein <st...@gmx.de>.
Hi Bob,
> > Should i read the value of FO_ID on my own, construct the dataobject and
> use setDataObject to set it or is there a cleaner/better way to solve
> this?
>
>
> You are right, you need to ensure the oidField contains its value
> *before* onProcess in order to populate the FormTable.
>
> You could encapsulate this "early binding" with a custom CayenneForm
> so that the oidField and classField values are available before
> onProcess. For example:
>
> public class MyCayenneForm extends CayenneForm {
>
> public MyCayenneForm(String name) {
> super(name);
>
> // Bind the oidField and classField to request parameters
> oidField.bindRequestValue();
> classField.bindRequestValue();
> }
> }
>
> Hope this helps.
thank you, it works with a little change, I must not bind the requestvalue of the classField. If I do so, setting the DataObject on an get request fails since the value of cause is null and setDataObject checks if the given object is of the right class.
kind regards,
Stefan
--
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a