|
|
Sample Programs from NeXSTEP 3.3
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;\f1\fmodern Ohlfs;}
\paperw10800
\paperh12580
\margl120
\margr100
{\colortbl;\red0\green0\blue0;}
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b\i0\ulnone\fs36\fc0\cf0 FlatFileDataSource
\b0\fs24 \
\
\
\b\fs28 Overview
\b0\fs24 \
\
\pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\fc0\cf0 This example shows how to create and use a flat file database with the EOF interface layer . Specifically, the application implements a master-detail setup (a to-many relationship between 2 entities)\
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
\pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\fc0\cf0 The flat file database is in ./DATABASE. It contains 2 tables:\
1- The Product.table (the master table)\
2- The Item.table (the detail table)\
A flat file table is a string "archive" of an NSArray of records. A record in the table is a property list (key-value pairs archived in a string format; take a look at the files...)\
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc1\cf1 \
\b\fs28 Program Organization
\b0\fs24 \
\
\pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\fc0\cf0 The interesting Class is the TableDataSource. This data source reads a flat file table (such as Product.table or Item.table) and generates EOGeneric records that can be passed to an EOController. The properties of these EOGeneric records can be displayed and modified using the EOF interface layer. As usual, the controller and the associated UI can be rapidly prototyped using Interface Builder. If you drag a model into IB to create the controllers, their dataSource outlet needs to be unset (look at FlatFileDataSource.nib). Only a few lines of codes are necessary to complete the setup. A TableDataSource must be instantiated and connected to the controller (see AppController.m). \
\
When an EOController creates new records, updates or deletes existing records, the data source will update the table file to reflect these changes when asked to "-saveObjects"... You can use EOModeler to specify the entities in your flat file database (watch out, there is no Adaptor! A little forgery is required) One major improvement would be to support flattened attribute. Look out for a forthcoming example!!! In the meantime, enjoy...\
\pard\tx560\tx1120\tx2060\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\fi-2060\li2060\fc1\cf1 \
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b\fs28\fc1\cf1 Usage
\pard\tx560\tx1120\tx2060\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\b0\fs24\fi-2060\li2060\fc1\cf1 \
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 Note that you need to run your application inside your project directory, because by default, the DATABASE folder is located inside the project directory. Otherwise, you need to make the appropriate change to the default path name (See AppController.m, DATABASE definition). \
\
Valid for NEXTSTEP 3.2 Release installed with EOF Release 1.0
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.