Re: Extending NSKeyValueCoding?
Re: Extending NSKeyValueCoding?
- Subject: Re: Extending NSKeyValueCoding?
- From: Michael Henderson <email@hidden>
- Date: Fri, 24 Oct 2003 07:09:07 -0700
Hi,
I normally either:
1. Implement NSKeyValueCoding use the static default methods to get
standard behavior and
add my extended behaviour
2. If extending a class that implements NSKeyValueCoding I implement:
handleTakeValueForUnboundKey()
handleQueryWithUnboundKey()
to get extended key value coding behavior.
For example all of my components subclass from my own subclass of
WOComponent which implements option 2
In my implementation of handleTakeValueForUnboundKey() I store the
value with the key in a NSDictionary instance variable
held by my component.
In handleQueryWithUnboundKey() I look up the value in the dictionary.
If the key is not found I defer to the component.s page's
implementation of the same method.
This allows my to code WORepetitions, etc w/o having to declare a
holder variable in my component for item or index.
I also added checks for keys beginning with 'has' to return true or
false if the component has a value for the key (minus the 'has' prefix)
which
works out nice for WOConditionals
I added similar behavior to a base class for my EOs. As a consequence
most of my components have only the class declaration and constructor
and no other methods (The app is mainly display).
Cheers,
Mike
_______________________________________________
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.