Hi John,

indeed dynamic behavior like this isn't supported by RIFE/Crud. I was thinking about it though. Maybe I could add an afterCreate callback to the Callbacks interface. This would allow you to dynamically add a defaultValue constraint for the property. My worry is the implementation though. To do this reliably, I'll probably have to instrument the bytecode of the default constructor and the clone method. This in itself isn't that difficult (though I like to keep core interface functionality not related to bytecode instrumenting), but detecting which classes need to be instrumented can be expensive in this case (since I need to check for every class if it implements the Callbacks or CallbacksProvider interface).

So, what you could do, is maybe use some AOP library for this to achieve the same functionality. It would be interesting to see how that works out. Maybe it's time to start thinking about adding some AOP support in RIFE itself, that can be used for adding core features like this.

Best regards,

Geert

On 27 May 2006, at 21:06, John T wrote:

Geert Bevin <gbevin <at> uwyn.com> writes:


Did you try the "defaultValue" constraint?


Using defaultValue is straightforward for *setting* the value, but how to I *get* the data from a field of the associated class? In pojo terms, I'd like
to the have roughly:

new rx = new Perscription();
//Set up associations
rx.setDosage(mDrug.getDossage());

Actually, I think I just figured out that you can't do this. The CRUD screen for the new Perscription mas dropdowns for the associated Drug and Patient, so we don't know those when the screen is rendered. I'll have to look more into CRUD customization, this sounds like a job for a little javascript in the page,
so that when the list changes, the defaults are set.

Thanks.

 - JT

On 27 May 2006, at 19:40, John T wrote:

Hello all.  I am hoping that there is an easy way to configre CRUD
to use a
value from an associated table for the default of a new record.
For example, a
Percription table that maps a relationship between a Patient and a
Drug.  The
Drug would have data for typical dosage, which the Perscription
would use by
default.

Patient---*-Perscription-*---Drug
             - dosage          - typicalDosage

So far, I am using CRUD for all data entry, and would like to keep
it that way
for a while.

Thanks in advance,

 - John

_______________________________________________
Rife-users mailing list
Rife-users <at> uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users


--
Geert Bevin Uwyn bvba GTalk: gbevin <at> gmail.com
"Use what you need"     Avenue de Scailmont 34  Skype: gbevin
http://www.uwyn.com     7170 Manage, Belgium      AIM: geertbevin
gbevin at uwyn dot com Tel: +32 64 84 80 03 Mobile: +32 477 302 599

PGP Fingerprint : 4E21 6399 CD9E A384 6619  719A C8F4 D40D 309F D6A9
Public PGP key  : available at servers pgp.mit.edu, wwwkeys.pgp.net





_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users


--
Geert Bevin             Uwyn bvba               GTalk: [EMAIL PROTECTED]
"Use what you need"     Avenue de Scailmont 34  Skype: gbevin
http://www.uwyn.com     7170 Manage, Belgium      AIM: geertbevin
gbevin at uwyn dot com  Tel: +32 64 84 80 03   Mobile: +32 477 302 599

PGP Fingerprint : 4E21 6399 CD9E A384 6619  719A C8F4 D40D 309F D6A9
Public PGP key  : available at servers pgp.mit.edu, wwwkeys.pgp.net


_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to