Re: Listening for changes on an EO

2009-07-09 Thread Chuck Hill
On Jul 9, 2009, at 10:24 AM, Lon Varscsak wrote: Is there a way for a controller object to listen for changes to an EO (and a specific key)? Thanks, Lon EOEditingContext has ObjectsChangedInEditingContextNotification, but it is on an object by object basis, not a key by key one. You

Re: Listening for changes on an EO

2009-07-09 Thread Simon McLean
also, if you are using wonder, check out hasKeyChangedFromCommittedSnapshot in ERXGenericRecord. maybe listen for the notification mentioned by chuck, then use hasKeyChangedFromCommittedSnapshot to check the particular key you are looking at. simon 2009/7/9 Chuck Hill ch...@global-village.net:

Re: Listening for changes on an EO

2009-07-09 Thread Lon Varscsak
Thanks. I figured there was nothing built to do exactly what I needed, but I figured I would ask. Do you know if there is much overhead if I implemented this in my EO superclass even if there were no observers? -Lon On Thu, Jul 9, 2009 at 11:50 AM, Simon McLeansi...@potwells.co.uk wrote:

Re: Listening for changes on an EO

2009-07-09 Thread Chuck Hill
On Jul 9, 2009, at 12:26 PM, Lon Varscsak wrote: Thanks. I figured there was nothing built to do exactly what I needed, but I figured I would ask. Do you know if there is much overhead if I implemented this in my EO superclass even if there were no observers? EOF makes heavy use of

Re: Listening for changes on an EO

2009-07-09 Thread Lon Varscsak
Thanks for the tips! -Lon On Thu, Jul 9, 2009 at 12:34 PM, Chuck Hillch...@global-village.net wrote: On Jul 9, 2009, at 12:26 PM, Lon Varscsak wrote: Thanks.  I figured there was nothing built to do exactly what I needed, but I figured I would ask. Do you know if there is much overhead if

Re: Listening for changes on an EO

2009-07-09 Thread Lon Varscsak
Uh, another question. :) Since I have a custom EO super-super class, I decided to try to implement this in takeStoredValueForKey(..). It works, although I was also trying to post the old value, and asking for this current value at this point makes EOF not so happy...but that's not strictly

Re: Listening for changes on an EO

2009-07-09 Thread Mark Morris
Just a clarification, do you want to know when the value changes, even if it's not saved to the database? Or do you just want to know if a change is being saved? That would make a difference. ;-) Regards, Mark On Jul 9, 2009, at 3:28 PM, Lon Varscsak wrote: Uh, another question. :)

Re: Listening for changes on an EO

2009-07-09 Thread Lon Varscsak
I want to know if it's being changed. I have a controller object that will need to recalculate some values when a specific attribute changes in the EO. -Lon On Thu, Jul 9, 2009 at 1:42 PM, Mark Morrisma...@onpointsoftware.com wrote: Just a clarification, do you want to know when the value

Re: Listening for changes on an EO

2009-07-09 Thread Lon Varscsak
Sorry I didn't finish the first sentence. I want to know when the value is being changed regardless of whether it's committed or not. On Thu, Jul 9, 2009 at 1:45 PM, Lon Varscsakvarsc...@smarthealth.com wrote: I want to know if it's being changed.  I have a controller object that will need to

Re: Listening for changes on an EO

2009-07-09 Thread Chuck Hill
On Jul 9, 2009, at 1:28 PM, Lon Varscsak wrote: Uh, another question. :) Since I have a custom EO super-super class, I decided to try to implement this in takeStoredValueForKey(..). It works, although I was also trying to post the old value, and asking for this current value at this point

Re: Listening for changes on an EO

2009-07-09 Thread Chuck Hill
On Jul 9, 2009, at 1:45 PM, Lon Varscsak wrote: I want to know if it's being changed. I have a controller object that will need to recalculate some values when a specific attribute changes in the EO. Why not just override the set... method to send the notification? -Lon On Thu, Jul 9,

Re: Listening for changes on an EO

2009-07-09 Thread Lon Varscsak
I was trying to make something more generic to be able to use in more than one case and keep my Velocity template clean of that stuff. Thanks again for all the help! -Lon On Thu, Jul 9, 2009 at 1:52 PM, Chuck Hillch...@global-village.net wrote: On Jul 9, 2009, at 1:45 PM, Lon Varscsak wrote:

Re: Listening for changes on an EO

2009-07-09 Thread Chuck Hill
You would put it in the sub-class, in a method that overrode the super- class, NOT in the generated class. e.g. public void setFoo(Number foo) { Number oldFoo = foo(); super.setFoo(foo); // calls the generated version // broadcast notification of this, this.editingContext(),