• 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
advice on filtering TreeNode objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

advice on filtering TreeNode objects


  • Subject: advice on filtering TreeNode objects
  • From: Alex Rice <email@hidden>
  • Date: Sun, 3 Nov 2002 01:42:24 -0700

I am using TreeNode objects for my outlineview. The treenode implementation is from Apple's NSOutlineView examples. I need to apply a filter to the root treenode and have it filter all the children on some condition, like hiding todo items that are completed, for example. I'm sure I can code it for that particular case, but I would rather implement a general-purpose filtering scheme, so I can expand it to keyword searching or other filters later on. I just can't conceptualize how to do it. Seems like there must be a design pattern here. Any suggestions? My TreeNode subclass implements NSKeyValueCoding so maybe that will help me out?

So far all I have is this method, not yet implemented:

- (void) setFilter: (TreeNodeFilter *) newFilter;

Here is the TreeNode interface

@interface TreeNode : NSObject {
@protected
TreeNode *nodeParent;
NSMutableArray *nodeChildren;
}
- (void) setNodeParent: (TreeNode*)parent;
- (TreeNode*) nodeParent;
- (void) appendChild: (TreeNode*)child;
- (void) insertChild: (TreeNode*)child atIndex:(int)index;
- (void) insertChildren: (NSArray*)children atIndex:(int)index;
- (void) removeChild: (TreeNode*)child;
- (void) removeFromParent;
- (int) indexOfChild: (TreeNode*)child;
- (int) indexOfChildIdenticalTo: (TreeNode*)child;
- (int) numberOfChildren;
- (NSArray*) children;
- (TreeNode*) firstChild;
- (TreeNode*) lastChild;
- (TreeNode*) childAtIndex: (int)index;
- (BOOL) isDescendantOfNode: (TreeNode*)node;
- (BOOL) isDescendantOfNodeInArray: (NSArray*)nodes;

Thanks,

Alex Rice <email@hidden>
Mindlube Software
http://mindlube.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: advice on filtering TreeNode objects
      • From: Chris Giordano <email@hidden>
    • Re: advice on filtering TreeNode objects
      • From: Andreas Mayer <email@hidden>
  • Prev by Date: Re: hand cursors
  • Next by Date: Re: (Part 1) Thread-safety Concerns
  • Previous by thread: Link: Cocoa-Thread safety concerns
  • Next by thread: Re: advice on filtering TreeNode objects
  • Index(es):
    • Date
    • Thread