// // MyDocument.m // DaMaT // // Created by Simon Urbanek on Fri Aug 30 2002. // Copyright (c) 2001 __MyCompanyName__. All rights reserved. // #import "MyDocument.h" #import "DatasetMsgBridge.h" @implementation MyDocument NSString *curFileName; - (NSString *)windowNibName { // Override returning the nib file name of the document // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead. return @"MyDocument"; } - (void)windowControllerDidLoadNib:(NSWindowController *) aController { printf("MyDoc.didLoadNib\n"); [super windowControllerDidLoadNib:aController]; if (ds!=nil) { int i,j; char buf[64]; NSTableColumn *tc; buf[63]=0; dmb=[[DatasetMsgBridge alloc] initWithDataset:ds]; [msgList setDataSource:dmb]; //[msgList addTableColumn:[[NSTableColumn alloc] initWithIdentifier:@"message"]]; //[msgList reloadData]; dsb=[[DatasetBridge alloc] initWithDataset:ds]; [dataSheet setDataSource:dsb]; i=0; j=[ds fieldCount]; while(iname) [[tc headerCell] setStringValue:[NSString stringWithCString:(fi->name)]]; i++; }; [dataSheet setDrawsGrid:YES]; [fileNameField setStringValue:curFileName]; [fileFormat setStringValue:[ds getFormatInfoString]]; snprintf(buf,63,"Total %d rows loaded.",[ds rows]); [totalRowsText setStringValue:[NSString stringWithCString:buf]]; } else { [self close]; } } - (NSData *)dataRepresentationOfType:(NSString *)aType { // Insert code here to write your document from the given data. You can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead. return nil; } - (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType { // Insert code here to read your document from the given data. You can also choose to override -loadFileWrapperRepresentation:ofType: or -readFromFile:ofType: instead. printf("loadDataRepresentation\n"); return YES; } - (BOOL)readFromFile:(NSString *)fName ofType:(NSString *)type { printf("readFromFile\n"); if (ds!=nil) [ds release]; ds=[[Dataset alloc] init]; if ([ds loadFromFile:[fName cString]]==nil) return nil; curFileName=fName; return YES; } - (void) dealloc { printf("MyDoc.dealloc\n"); if (ds!=nil) [ds release]; [super dealloc]; } // export dataset - (IBAction)doExport:(id)sender { } @end