TreeItem.st
changeset 5629 afcdc42d662f
parent 5628 afbbddcc2951
child 5635 4fe9214fa41f
equal deleted inserted replaced
5628:afbbddcc2951 5629:afcdc42d662f
   289     ^self retrieveAndEvaluate: #iconAction
   289     ^self retrieveAndEvaluate: #iconAction
   290 
   290 
   291     "Modified (comment): / 04-02-2017 / 20:24:16 / cg"
   291     "Modified (comment): / 04-02-2017 / 20:24:16 / cg"
   292 !
   292 !
   293 
   293 
       
   294 label
       
   295     "for protocol compatibility with herarchical item"
       
   296     
       
   297     ^ self name
       
   298 
       
   299     "Created: / 20-10-2017 / 11:30:15 / cg"
       
   300 !
       
   301 
       
   302 labelPath
       
   303     "for protocol compatibility with herarchical item"
       
   304 
       
   305     ^ ({self} , self allParents) reverse collect:#label
       
   306 
       
   307     "Created: / 20-10-2017 / 11:30:07 / cg"
       
   308 !
       
   309 
   294 level
   310 level
   295     "get the nesting level"
   311     "get the nesting level"
   296 
   312 
   297     |p lvl|
   313     |p lvl|
   298 
   314 
   439     ^ max
   455     ^ max
   440 ! !
   456 ! !
   441 
   457 
   442 !TreeItem methodsFor:'accessing-hierarchy'!
   458 !TreeItem methodsFor:'accessing-hierarchy'!
   443 
   459 
       
   460 allParents
       
   461     "return a collection of all parents (in parent, grandparent, ... order)"
       
   462 
       
   463     |parents|
       
   464 
       
   465     parents := OrderedCollection new.
       
   466     self parentsDo:[:p | parents add:p].
       
   467     ^ parents.
       
   468 
       
   469     "Created: / 20-10-2017 / 11:31:06 / cg"
       
   470 !
       
   471 
   444 collapse 
   472 collapse 
   445     "hide all my children
   473     "hide all my children
   446     "
   474     "
   447     hide := true
   475     hide := true
   448 !
   476 !
   469     hide := false.
   497     hide := false.
   470 
   498 
   471     self children notEmpty ifTrue:[
   499     self children notEmpty ifTrue:[
   472         children do:[:aChild| aChild expandAll ]
   500         children do:[:aChild| aChild expandAll ]
   473     ]
   501     ]
       
   502 !
       
   503 
       
   504 parentsDo:aBlock
       
   505     "evaluate a block for each parent"
       
   506 
       
   507     |prnt|
       
   508 
       
   509     prnt := self.
       
   510 
       
   511     [(prnt := prnt parent) notNil] whileTrue:[
       
   512         aBlock value:prnt
       
   513     ].
       
   514 
       
   515     "Created: / 20-10-2017 / 11:31:41 / cg"
   474 ! !
   516 ! !
   475 
   517 
   476 !TreeItem methodsFor:'accessing-mvc'!
   518 !TreeItem methodsFor:'accessing-mvc'!
   477 
   519 
   478 model
   520 model