AbstractHierarchicalItem.st
changeset 5623 bc0518c6c923
parent 5490 4cde54dd83bd
child 5624 c8e2d911f9c4
equal deleted inserted replaced
5621:bc187db92ab4 5623:bc0518c6c923
   318             self setExpanded:true
   318             self setExpanded:true
   319         ]
   319         ]
   320     ].
   320     ].
   321 !
   321 !
   322 
   322 
       
   323 labelPath
       
   324     "return my label-path as an ordered collection of individual labels"
       
   325 
       
   326     ^ ({self} , self allParents) reverse collect:#label
       
   327 
       
   328     "Created: / 16-10-2017 / 13:09:10 / cg"
       
   329     "Modified: / 16-10-2017 / 14:16:46 / cg"
       
   330 !
       
   331 
   323 makeVisible
   332 makeVisible
   324     "expand all my parents"
   333     "expand all my parents"
   325 
   334 
   326     (parent notNil and:[parent isHierarchicalItem]) ifTrue:[
   335     (parent notNil and:[parent isHierarchicalItem]) ifTrue:[
   327         self criticalDo:[
   336         self criticalDo:[
   895     "Created: / 17-01-2011 / 17:43:42 / cg"
   904     "Created: / 17-01-2011 / 17:43:42 / cg"
   896 ! !
   905 ! !
   897 
   906 
   898 !AbstractHierarchicalItem methodsFor:'enumerating'!
   907 !AbstractHierarchicalItem methodsFor:'enumerating'!
   899 
   908 
       
   909 allExpandedItemsDo:aBlock
       
   910     "recursively enumerate all expanded nodes 
       
   911      (depth first; parent before children)"
       
   912     
       
   913     self recursiveDo:[:each |
       
   914         each isExpanded ifTrue:[
       
   915             aBlock value:each.
       
   916         ].
       
   917     ].
       
   918 
       
   919     "Created: / 16-10-2017 / 14:19:00 / cg"
       
   920 !
       
   921 
   900 collect:aBlock
   922 collect:aBlock
   901     "for each child in the receiver (non recursive), evaluate the argument, aBlock
   923     "for each child in the receiver (non recursive), evaluate the argument, aBlock
   902      and return a new collection with the results"
   924      and return a new collection with the results"
   903 
   925 
   904     |coll|
   926     |coll|
  1105 
  1127 
  1106     "Modified (comment): / 25-11-2016 / 08:44:49 / cg"
  1128     "Modified (comment): / 25-11-2016 / 08:44:49 / cg"
  1107 ! !
  1129 ! !
  1108 
  1130 
  1109 !AbstractHierarchicalItem methodsFor:'enumerating parents'!
  1131 !AbstractHierarchicalItem methodsFor:'enumerating parents'!
       
  1132 
       
  1133 allParents
       
  1134     "return a collection of all parents (in parent, grandparent, ... order)"
       
  1135 
       
  1136     |parents|
       
  1137 
       
  1138     parents := OrderedCollection new.
       
  1139     self parentsDo:[:p | parents add:p].
       
  1140     ^ parents.
       
  1141 
       
  1142     "Created: / 16-10-2017 / 13:08:45 / cg"
       
  1143 !
  1110 
  1144 
  1111 parentsDetect:aBlock
  1145 parentsDetect:aBlock
  1112     "find the first parent, for which evaluation of the block returns
  1146     "find the first parent, for which evaluation of the block returns
  1113      true; if none does so, report an error"
  1147      true; if none does so, report an error"
  1114 
  1148