* 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:
Gregory John Casamento 2007-08-15 03:24:37 +00:00
parent 37edf8c87d
commit e806acc75d
6 changed files with 103 additions and 7 deletions

View file

@ -1,3 +1,11 @@
2007-08-14 23:22-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* 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.
2007-08-15 Fred Kiefer <FredKiefer@gmx.de>
* Headers/Additions/GNUstepGUI/GSDisplayServer.h (-setShadow::),

View file

@ -37,6 +37,7 @@
@interface NSController : NSObject <NSCoding>
{
NSMutableArray *_editors;
NSMutableArray *_declared_keys;
}
// NSEditor protocol

View file

@ -43,14 +43,20 @@
@interface NSObjectController : NSController
{
@protected
Class _object_class;
NSString *_object_class_name;
NSString *_entity_name_key;
id _managed_proxy;
id _content;
NSMutableArray *_selection;
NSString *_entity_name_key;
NSPredicate *_fetch_predicate;
NSManagedObjectContext *_managed_object_context;
BOOL _is_editable;
BOOL _automatically_prepares_content;
BOOL _is_using_managed_proxy;
}
- (id) initWithContent: (id)content;

View file

@ -214,7 +214,8 @@ GSPDFPrintOperation.m \
GSModelLoaderFactory.m \
GSGormLoader.m \
GSGModelLoader.m \
GSNibLoader.m
GSNibLoader.m \
NSManagedObjectContext.m
# Turn off NSMenuItem warning that NSMenuItem conforms to <NSObject>,
# but does not implement <NSObject>'s methods itself (it inherits

View file

@ -26,20 +26,27 @@
*/
#include <Foundation/NSArray.h>
#include <Foundation/NSArchiver.h>
#include <Foundation/NSKeyedArchiver.h>
#include <AppKit/NSController.h>
@implementation NSController
- (id) init
{
_editors = [[NSMutableArray alloc] init];
if((self = [super init]) != nil)
{
_editors = [[NSMutableArray alloc] init];
_declared_keys = [[NSMutableArray alloc] init];
}
return self;
}
- (void) dealloc
{
RELEASE(_editors);
RELEASE(_declared_keys);
[super dealloc];
}
@ -50,7 +57,18 @@
- (id) initWithCoder: (NSCoder *)aDecoder
{
// TODO
if((self = [super init]) != nil)
{
if([aDecoder allowsKeyedCoding])
{
NSLog(@"%@-%@",self,[aDecoder keyMap]);
ASSIGN(_declared_keys,[aDecoder decodeObjectForKey: @"NSDeclaredKeys"]);
}
else
{
ASSIGN(_declared_keys,[aDecoder decodeObject]);
}
}
return self;
}

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;
}