• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSOutlineView slow update w Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSOutlineView slow update w Core Data


  • Subject: NSOutlineView slow update w Core Data
  • From: "David Melgar" <email@hidden>
  • Date: Wed, 5 Mar 2008 00:14:08 -0500

I have an NSOutlineView subclass bound to a NSTreeController subclass which
is bound to a simple data model representing a hierarchical tree structure.
I've implemented drag and drop by having the view send a custom message to
my NSTreeController subclass who then updates the model. The problem is that
there is then a delay of about 1 second before the view displays the added
node.

I've noticed that if I move the mouse out of the OutlineView, then it seems
to update immediately. Any idea what I maybe doing wrong? Is it possible
that core data and all the observing patterns are really taking this long to
percolate the change back to the view? Am I supposed to do something to wake
up the view faster?

I'm using Leopard (10.5.2), XCode 3, Objective-C 2.0. I don't have any code
to deal with memory management. If I run with garbage collection
unsupported, the OutlineView never updates UNTIL I move the mouse out of the
OutlineView. If garbage collection is enabled, there is the 1 second delay.
With garbage collection supported, there are no errors or exceptions listed
in the console.

MyOutlineView has the following method

- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {

    NSPasteboard *pboard;

    NSDragOperation sourceDragMask;

     sourceDragMask = [sender draggingSourceOperationMask];

    pboard = [sender draggingPasteboard];

 if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {

        NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];

if (myTreeController != NULL) {

[myTreeController addFiles:files];

}

}

    return YES;

}

MyTreeController method is as follows:

- (void)addFiles:(NSArray *)droppedFilenames {

NSManagedObjectContext *moc = [self managedObjectContext];

for (NSString *name in droppedFilenames) {

NSManagedObject *bfile = [NSEntityDescription
insertNewObjectForEntityForName:@"bFiles" inManagedObjectContext:moc];

[bFile setName: name];

}

}


The model is:

Entity name: bFiles

Attribute: name

relationship: parent, optional, bFiles

relationship: child,  optional, bFiles


I have MyTreeController nib configured with the following attributes

Keypaths: children = children

Options: avoid empty selection, preserve selection, select inserted objects

ObjectController:

Mode=Entity

Entity name = bFiles

Prepares content, editable


I have MyTreeController bound as follows:

Parameters, ManagedObjectContext

bind to File's Owner

Model key path = managedObjectContext

Raises for not applicable keys


I don't have my NSOutlineView bound to anything but I do have the contained
TableColumn bound as follows:

Value: bind to: Tree Controller

Controller Key = arrangedObjects

Model Key Path = name

Allows editing multiple value selection

Creates sort descriptor

Raises for not applicable keys


Thats about everything pertinent that I can think of. Any suggestions
appreciated.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSOutlineView slow update w Core Data
      • From: David <email@hidden>
  • Prev by Date: CATiledLayer too slow to update
  • Next by Date: Re: (Resolved) How to get an NSString from a non-terminated array of unicode chars (length is known)
  • Previous by thread: Re: CATiledLayer too slow to update
  • Next by thread: Re: NSOutlineView slow update w Core Data
  • Index(es):
    • Date
    • Thread