* Headers/AppKit/NSController.h: Added new ivar.

* Headers/AppKit/NSObjectController.h: Added new ivar.
        * Source/GNUmakefile: Added NSManagedObjectContext.[hm].
        * Source/NSController.m: Add keys for nib encoding/decoding.
        * Source/NSObjectController.m: Add keys for nib encoding/decoding.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25391 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2007-08-15 03:24:37 +00:00
parent 87163a8515
commit 6e1fd2e328
6 changed files with 103 additions and 7 deletions

View file

@ -29,8 +29,62 @@
#include <Foundation/NSDictionary.h>
#include <Foundation/NSPredicate.h>
#include <Foundation/NSString.h>
#include <Foundation/NSArchiver.h>
#include <Foundation/NSKeyedArchiver.h>
#include <AppKit/NSObjectController.h>
@interface _NSManagedProxy : NSObject
{
NSString *_entity_name_key;
}
- (void) setEntityName: (NSString *)name;
- (NSString *) entityName;
@end
@implementation _NSManagedProxy
- (id) initWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
{
NSLog(@"%@ - %@",self,[coder keyMap]);
ASSIGN(_entity_name_key,[coder decodeObjectForKey: @"NSEntityName"]);
}
else
{
ASSIGN(_entity_name_key,[coder decodeObject]);
}
}
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
{
[coder encodeObject: _entity_name_key forKey: @"NSEntityName"];
}
else
{
[coder encodeObject: _entity_name_key];
}
}
- (void) dealloc
{
RELEASE(_entity_name_key);
[super dealloc];
}
- (void) setEntityName: (NSString *)name
{
ASSIGN(_entity_name_key, name);
}
- (NSString *) entityName
{
return _entity_name_key;
}
@end
@implementation NSObjectController
- (id) initWithContent: (id)content
@ -67,8 +121,6 @@
- (id) initWithCoder: (NSCoder *)aDecoder
{
self = [super initWithCoder: aDecoder];
// TODO
if ([self automaticallyPreparesContent])
{
if ([self managedObjectContext] != nil)
@ -81,6 +133,16 @@
}
}
if([aDecoder allowsKeyedCoding])
{
_is_editable = [aDecoder decodeBoolForKey: @"NSEditable"];
_automatically_prepares_content = [aDecoder decodeBoolForKey: @"NSAutomaticallyPreparesContent"];
ASSIGN(_managed_proxy, [aDecoder decodeObjectForKey: @"_NSManagedProxy"]);
}
else
{
}
return self;
}