Dear Flor.
The getter and setter methods are ok, but it think there is a better way. This is how the EOAssociation (and its subclasses) works.
They are bidirectional: From the widget to the EODisplayGroup the EOAssociation class, I believe they are listener (analyzing the code generated by the old nib files in the EOArchive class), but from the EO to the the widget I believe the EOAssociation uses the EODisplayGroup class.
The EOAssociations does not need to sublcass the EO.
Why not use EOAssociations and EODisplayGroup?
Ricardo.
*************************** 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
|