Re: NSDictionary, EOComboBoxController, and EOAssociation subclassing
Re: NSDictionary, EOComboBoxController, and EOAssociation subclassing
- Subject: Re: NSDictionary, EOComboBoxController, and EOAssociation subclassing
- From: Brent Shank <email@hidden>
- Date: Mon, 27 Jan 2003 13:21:44 -0800
Bill,
I think your data model may be complicating things. If you have an
entity called GradingScheme, it could have two significant attributes:
gradingKey and gradingKeyDescription. In the client app, you display
only the gradingKeyDescription in the combo box. The user's selections
then automatically end up storing key-value pairs in the database. The
"keys" in this case are the gradingKeys, and the "values" are the key's
descriptions. I don't understand why you're storing NSDictionaries in
the userInfo for each attribute. That just seems overly complicated.
But perhaps you have other reasons for doing it this way?
I don't think you'll get very far implementing
EOValueSelectionAssociation and overriding setValueForAspect. In most
cases, when you think you have to resort to drastic measures like this,
most often something is wrong with the application's data model.
So, if you can rework the data model and database schema, you can get
the effect you want without writing more code. Feel free to send me
your EOModel if you think that will help me better understand the
problem.
Brent
On Monday, January 27, 2003, at 06:23 AM, William Butler wrote:
I am trying to get EOComboBoxController to work with an NSDictionary,
such that the values are displayed to the user but it is the key that
is read from and stored to the database according to the selected
value. One can override newAssociation in EOComboBoxController to have
it use the "SelectedIndex", "SelectedTitle" or "SelectedObject", but
neither of these is what I need.
I work in the healthcare field, where there many many grading schemes
(I='Stubbed toe without abrasion', Ib='Stubbed toe with epidermis
abrasion'...etc--you get the picture). I store the NSDictionaries in
userInfo() for each EOAttribute. It was pretty easy to get it to work
with html D2W. Out of the box D2JC wants you to use to use a to-one
relationship for this, but would entail large numbers of entities for
me since many of my fields reflect a grading scheme, so I'd rather use
the existing NSDictionaries. One could probably override many accessor
methods in the client side enterprise objects to do this, but this
seems clunky to me.
So my understanding is the D2JC 'wants' you to override
EOValueSelectionAssociation to do this, but there isn't enough
documentation on how to do it nor are there examples. I tried it by
overriding setValueForAspect and valueForAspect, but this caused the
client side program to dump with a 'Bus error' message.
Does anyone else have any ideas on how to do this? I'm coming at
things from the WO side, so EOAssociation is a new concept for me. It
may be that folks coming from the Cocoa side are fluent with this
problem.
Thanks,
Bill Butler
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.