Key-Value coding for mutable one-many value (Java)
Key-Value coding for mutable one-many value (Java)
- Subject: Key-Value coding for mutable one-many value (Java)
- From: Bill Gardner <email@hidden>
- Date: Sat, 20 Mar 2004 21:39:20 +0900
In order to set the content array for an NSArrayController from Java
for a property with key "topic",
I create methods in the class (a subclass of NSWindowController) which
I bind to
the contentArray of the array controller -
public int countOfTopics()
and
public Object objectInTopicsAtIndex(int index)
This works fine as long as the one-many property is immutable. However,
in order to
call addObject on the arrayController, the one-many property needs to
be mutable.
So I add the following methods to my class -
public void removeObjectFromTopicsAtIndex(int index)
and
public void insertObjectinTopicsAtIndex(Object topic, int index)
This fails with
"setValue:forUndefinedKey:]: this class is not key value
coding-compliant for the key topics"
Can anyone shed any light on why this isn't working?
(The alternative of having get/set methods for an NSMutableArray -
getTopics and setTopics seems
to work fine, but I don't want to maintain the data in a mutable array.)
Thanks.
Bill Gardner.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.