--- a/HierarchicalItem.st Mon Oct 07 12:34:51 2002 +0200
+++ b/HierarchicalItem.st Mon Oct 07 18:30:53 2002 +0200
@@ -1334,13 +1334,10 @@
!
sortChildren:aSortBlock
- |children|
-
- (children := self children) notNil ifTrue:[
- self criticalDo:[
- children sort:aSortBlock
- ]
- ].
+ "sort the children inplace using the 2-arg block sortBlock for comparison
+ "
+ self obsoleteMethodWarning:'renamed to sort:'.
+ self sort:aSortBlock.
! !
!HierarchicalItem methodsFor:'protocol displaying'!
@@ -1620,6 +1617,23 @@
^ self recursiveDetect:aOneArgBlock
! !
+!HierarchicalItem methodsFor:'sort & reordering'!
+
+sort:aSortBlock
+ "sort the children inplace using the 2-arg block sortBlock for comparison
+ "
+ |unsorted|
+
+ self criticalDo:[
+ unsorted := self children.
+
+ unsorted size ~~ 0 ifTrue:[
+ children := unsorted sort:aSortBlock.
+ self childrenOrderChanged.
+ ]
+ ].
+! !
+
!HierarchicalItem::Example class methodsFor:'instance creation'!
labeled:aLabel
@@ -1760,5 +1774,5 @@
!HierarchicalItem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalItem.st,v 1.42 2002-09-28 06:24:24 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalItem.st,v 1.43 2002-10-07 16:30:53 ca Exp $'
! !