Talk About Network

Google





Mac > Mac Programmer Tools > Re: Core Data U...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 580 of 637
Post > Topic >>

Re: Core Data UI

by David Phillip Oster <oster@[EMAIL PROTECTED] > Jan 24, 2007 at 05:38 AM

In article <ep4got$f0f$1@[EMAIL PROTECTED]
>,
 "Luca_a" <nojunk@[EMAIL PROTECTED]
> wrote:

> Hi everyone,
> 
> I am an experienced Windows C++ programmer, but quite new to Mac os 
> programming.
> I have just started to evaluate Core Data framework by using it to put 
> together a small database.
> Let's explain my problem with usual Employee, Department example.
> I have created Employee and  Department entities, each with their own
set of 
> attributes.
> There is To-Many relation****p called "employees" defined for Department
with 
> Employee as destination.
> There is also To-One relation****p called "department" defined for
Student 
> with Department as destination.
> 
> In my user interface I have two NSTableView  : Employee NSTableView that

> allows user to enter list of employees attributes by calling add, remove

> methods of  EmployeeArrayController. Department NSTableView  that allows

> user to enter list of departments attributes by calling add, remove
methods 
> of  DepartmentArrayController.
> 
> What I don't understand is
> 
> 1. How to actually add data to tables using the UI, eg:  how to select
John 
> from the list of employees and tell to the framework that John is in the

> Sales department and so on, so that I can assign all employees to their 
> departments.
> 
> 2. After I did that task the next question is what is the best way to 
> display data for example how to select a department from list of
departments 
> and as a result all employees in that department are displayed
> 

Outside the U.I., you can do programmatic data manipulation:

  * you can use NSFetchRequests to retrieve objects from the 
managedObjectContext, 
  * Use [NSEntityDescription entityForName:... to create new instances 
of objects
  * use mogenerator ( http://www.rentzsch.com/code/mogenerator
) to 
define methods that let you work with Core Data objects using ordinary 
setters and getters.
  * Use the managedObjectContext's deleteObject: to remove an object.

That is the spectrum of Fetch, Add, Modify, and Delete that you need to 
work with database objects.

The easiest way to create NSFetchRequests is to use Xcode's data modeler 
to put them right in your graphical model.

Note that to the left of the scrollbar at the bottom of the middle pane 
is a downward pointing triangle. Click and hold on it to get a popup 
menu to flip the Xcode modeller U.I. from fetch request mode back to 
attribute editing.
 




 4 Posts in Topic:
Core Data UI
"Luca_a" <no  2007-01-23 17:24:25 
Re: Core Data UI
Chris Hanson <cmh@[EMA  2007-01-23 01:07:43 
Re: Core Data UI
"Luca_a" <no  2007-01-25 16:43:14 
Re: Core Data UI
David Phillip Oster <o  2007-01-24 05:38:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 22:28:27 PST 2009.