Hm, this does not really work for me. My change events contain:

1. Changed EO
2. The key on which it changed
3. The old value (where applicable)

based on that I can extract:

4. The new value
5. The type of the property


The stuff I have already made relies on all of this information, so the notification simply will not do. And, IIRC, the mentioned notification only gets posted when you ask the EC to save changes. This is NOT what I need. I need immediate feedback.

No words of wisdom on these methods, Chuck?

public void takeStoredValueForKey(Object value, String key)
protected void includeObjectIntoPropertyWithKey(Object eo, String key)
protected void excludeObjectFromPropertyWithKey(Object eo, String key)

API and some testing suggests that using them to fire events should do. Except for the fact that they get called also when the objects are being initialized after construction. I'd have to work around that.

Thanks,
Flor


On Jan 07, 2008, at 16:19, Chuck Hill wrote:

What about the EOObjectsChangedInEditingContextNotification?

This notification is broadcast whenever changes are made in an EOEditingContext. It's similar to ObjectsChangedInStoreNotification, except that it contains objects rather than globalIDs.
...
Interface layer EODisplayGroups (not WebObjects WODisplayGroups) listen for this notification to redisplay their contents


That sounds like it may do what you want and send fewer notifications. IIRC, it is called at the end of the RR loop in a WO app, not sure about JC. I think this is part of what the processRecentChanges() or _processRecentChanges() method does.


Chuck


On Jan 7, 2008, at 7:55 AM, Florijan Stamenkovic wrote:

Guido,

Thanks for the reply. I do not need this for logging. Where I need it in are Java Client applications. I am just finishing up a library that will make it quite easy to build WO + Swing applications. The library is totally event driven, all the GUI controllers and all that stuff has been made to respond to events fired by EOs that have changed. So, the end purpose is keeping the GUI in synch with the current state of EOs.

So, if the changes in the end get saved to the database or not is not relevant in my scenario.

That being said, what do you think? Till now my solution was to use EOGenerator to define setters that take care of event firing, when needed. This works, but I always wanted to do this more elegantly, and overriding the mentioned methods seems just about right. I am just wondering if EOF can at any time for any reason bypass them. Reading the API makes me think it can not, but I wanted to check...

Flor

On Jan 06, 2008, at 19:03, Guido Neitzer wrote:

On 06.01.2008, at 15:53, Florijan Stamenkovic wrote:

I am trying to make an EOGenericRecord subclass that will automatically fire events when new values are set. It is imperative that the event firing is absolute, nothing can be allowed to slip by, if a property changes in any way, an event has to be fired.

Hmm. Do you want to log the change in the EO or the change in the database? Because if you log changes to the EO, you might end up with logged stuff that was never saved and therfor does not exist outside the scope of where the change happened (and was reverted).

What I did for logging changes to EOs was checkin in "willUpdate" (using Wonder) by getting the changes from the snapshot. I also have some code to check whether relationships change but that is not really thought out completely.

cug

--
http://www.event-s.net


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill% 40global-village.net

This email sent to [EMAIL PROTECTED]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to