<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -66,4 +66,17 @@
     return _childNodes[anIndex];
 }
 
+- (void)sortWithSortDescriptors:(CPArray)sortDescriptors recursively:(BOOL)shouldSortRecursively
+{
+    [_childNodes sortUsingDescriptors:sortDescriptors];
+
+    if (!shouldSortRecursively)
+        return;
+
+    var count = [_childNodes count];
+
+    while (count--)
+        [_childNodes[count] sortWithSortDescriptors:sortDescriptors recursively:YES];
+}
+
 @end</diff>
      <filename>AppKit/CPTreeNode.j</filename>
    </modified>
    <modified>
      <diff>@@ -59,6 +59,11 @@ CPOrderedDescending     =  1;
     BOOL        _ascending;
 }
 
++ (id)sortDescriptorWithKey:(CPString)aKey ascending:(BOOL)isAscending
+{
+    return [[self alloc] initWithKey:aKey ascending:isAscending];
+}
+
 // Initializing a sort descriptor
 /*!
     Initializes the sort descriptor.
@@ -71,6 +76,11 @@ CPOrderedDescending     =  1;
     return [self initWithKey:aKey ascending:isAscending selector:@selector(compare:)];
 }
 
++ (id)sortDescriptorWithKey:(CPString)aKey ascending:(BOOL)isAscending selector:(SEL)aSelector
+{
+    return [[self alloc] initWithKey:aKey ascending:isAscending selector:aSelector];
+}
+
 /*!
     Initializes the sort descriptor
     @param aKey the property key path to sort</diff>
      <filename>Foundation/CPSortDescriptor.j</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c8ed0f543665a7bb686c31369841d4208c996af8</id>
    </parent>
  </parents>
  <author>
    <name>Francisco Ryan Tolmasky I</name>
    <email>francisco@280north.com</email>
  </author>
  <url>http://github.com/Shadowfiend/cappuccino/commit/d6ac69029bf8f0025e25d55254307fb27f6334bd</url>
  <id>d6ac69029bf8f0025e25d55254307fb27f6334bd</id>
  <committed-date>2009-09-14T03:47:57-07:00</committed-date>
  <authored-date>2009-09-14T03:47:57-07:00</authored-date>
  <message>Added sorting capabilities to CPTreeNode.

Reviewed by me.</message>
  <tree>901cf5760b528ecd0c24d62e3f2726051fa116f5</tree>
  <committer>
    <name>Francisco Ryan Tolmasky I</name>
    <email>francisco@280north.com</email>
  </committer>
</commit>
