Hello again me.

So I solved this doing the following.

Separate the NSColletionViewItem into a different XIB.
In the Main Xib the the Object Controller for the NSColletionViewItem tell it 
to load from that new XIB.
Now the funny part, Bindings and Core Data still doesn't work, so what I did 
was :


-(void)setRepresentedObject:(id)representedObject{
    [super setRepresentedObject:representedObject];
    
    if([[representedObject entity].name isEqualToString:DPA_VERSION_KEY] ){
        DPAVersion * ver = (DPAVersion *)representedObject;
        self.dataSource = [[NSArray arrayWithArray:[[ver 
valueForKey:DPA_VERSION_TO_VERSION_FILES_KEY] allObjects]] retain];
    }
 
}


and then I connect the dataSoruces and delegate of the table view to the File 
Owner (which is my subclass of NSCollectionViewItem), and then implemetn the 
proper methods and voila it worked..

Now a downside is that I will have to implement the sort of the table because I 
lost that feature as Im not using an NSArrayController to populate the table 
but a datasource.

G.





On Apr 28, 2011, at 3:35 PM, Gustavo Pizano wrote:

> Hello all.
> 
> I have been researching and I only found somebody who had the same problem, 
> but the question went unsolved, so Im sorry if I ask again, I hope somebody 
> can enlighten me. 
> 
> I have a NSCollectionView and its respective NSCollectionViewItem,  also I 
> have a NSTableView wich displays the properties of an Entity VERSION,  The 
> NSCollecitonView contents its bound to the selectedObjects of this table, so 
> one I select something (1 or more) I see that the view I designed for the 
> NSCollectionViewItem appears with the properties of VERSION (which were bound 
> to the NSCollectionViewItem as representedObject.number , etc).
> Now problem is that VERSION has a to-many relation with a entity called 
> FILES_PER_VERSION, and in the view of the NSCollectionViewItem need to 
> display in a table the properties of this entity.
> 
> I have tried using directly IB bindings but that doesnt seem to work. So I 
> subclassed NSCollectionViewController and add a NSArrayController as an ivar 
> called representedToVersionFilesArrayController.
> 
> then in the setRepresentedObject Im doing the following:
> 
> 
> 
> -(void)setRepresentedObject:(id)representedObject{
>    [super setRepresentedObject:representedObject];
> 
>    if([[representedObject entity].name isEqualToString:DPA_VERSION_KEY] ){
>        NSLog(@"DP Analyzer >>> represented Object is kind of entity 
> DPAVersionFile");
>        DPAVersion * ver = (DPAVersion *)representedObject;
>        NSLog(@"DP Analyzer >>>  Got version files ");
>        self.representedToVersionFilesSet = [[NSArrayController alloc] init];
>        [self.representedToVersionFilesSet 
> setAutomaticallyPreparesContent:YES];
>        [self.representedToVersionFilesSet setEntityName:DPA_FILE_VERSION_KEY];
>        [self.representedToVersionFilesSet 
> setManagedObjectContext:[(DP_AnalyzerAppDelegate *)[[NSApplication 
> sharedApplication] delegate] managedObjectContext]];
>        [self.representedToVersionFilesSet bind:@"contentSet" toObject:ver  
> withKeyPath:DPA_VERSION_TO_VERSION_FILES_KEY options:nil];
> 
>    }
> 
> 
> }
> 
> and then in IB in the table with is inside the view of the 
> NSCollectionViewController (or in this case my subclass of it), Im binding 
> each table column to 
> representedToVersionFilesArrayController.arrangedObjects.<property_of_FILES_PER_VERSION
> 
> results nothing yet, so i dunno what am i missing or doing really bad. I have 
> checked that [ver valueForKey: DPA_VERSION_TO_VERSION_FILES_KEY] is returning 
> me an NSSet with the entities related to ver, so there is data, but I hadn't 
> been able to bind it to the table.
> 
> Any suggestions?
> Please ?
> 
> thx
> 
> Gustavo
> 

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to