SelectionInTree.st
changeset 762 df337e82f064
parent 758 0f0b16a16fa7
child 811 a688e8f11bc6
equal deleted inserted replaced
761:d0cf8f76f1b6 762:df337e82f064
    11 "
    11 "
    12 
    12 
    13 
    13 
    14 
    14 
    15 Model subclass:#SelectionInTree
    15 Model subclass:#SelectionInTree
    16 	instanceVariableNames:'root list selection showRoot'
    16 	instanceVariableNames:'root list selection showRoot contentsAction labelAction
       
    17 		childrenAction iconAction'
    17 	classVariableNames:''
    18 	classVariableNames:''
    18 	poolDictionaries:''
    19 	poolDictionaries:''
    19 	category:'Interface-Support-Models'
    20 	category:'Interface-Support-Models'
    20 !
    21 !
    21 
    22 
    69 !
    70 !
    70 
    71 
    71 root:aRoot
    72 root:aRoot
    72     "set a new root
    73     "set a new root
    73     "
    74     "
       
    75     root notNil ifTrue: [
       
    76         root tree: nil
       
    77     ].
       
    78 
    74     (root := aRoot) notNil ifTrue:[
    79     (root := aRoot) notNil ifTrue:[
    75         root parent:nil
    80         root parent:nil.
    76     ].
    81         root tree: self.
       
    82     ]. 
    77     self recomputeList.
    83     self recomputeList.
    78 
    84 
    79 ! !
    85 ! !
    80 
    86 
    81 !SelectionInTree methodsFor:'accessing behavior'!
    87 !SelectionInTree methodsFor:'accessing behavior'!
       
    88 
       
    89 childrenAction
       
    90     "get children action block
       
    91     "
       
    92     ^childrenAction
       
    93 !
       
    94 
       
    95 childrenAction:aBlock
       
    96     "set children action block
       
    97     "
       
    98     childrenAction := aBlock.
       
    99 
       
   100     self changed:#list.
       
   101     
       
   102 !
       
   103 
       
   104 contentsAction
       
   105     "get contents action block
       
   106     "
       
   107     ^contentsAction
       
   108 !
       
   109 
       
   110 contentsAction:aBlock
       
   111     "set contents action block
       
   112     "
       
   113     contentsAction := aBlock.
       
   114 
       
   115     self changed:#list.
       
   116     
       
   117 !
       
   118 
       
   119 iconAction
       
   120     "get icon action block
       
   121     "
       
   122     ^iconAction
       
   123 !
       
   124 
       
   125 iconAction:aBlock
       
   126     "set icon action block
       
   127     "
       
   128     iconAction := aBlock.
       
   129 
       
   130     self changed:#list.
       
   131     
       
   132 !
       
   133 
       
   134 labelAction
       
   135     "get label action block
       
   136     "
       
   137     ^labelAction
       
   138 !
       
   139 
       
   140 labelAction:aBlock
       
   141     "set label action block
       
   142     "
       
   143     labelAction := aBlock.
       
   144 
       
   145     self changed:#list.
       
   146     
       
   147 !
    82 
   148 
    83 showRoot
   149 showRoot
    84     "list with or without root
   150     "list with or without root
    85     "
   151     "
    86     ^ showRoot
   152     ^ showRoot
   237     self dependents do:[:aDependent|
   303     self dependents do:[:aDependent|
   238         aDependent isView ifTrue:[ aDependent invalidate ]
   304         aDependent isView ifTrue:[ aDependent invalidate ]
   239     ].
   305     ].
   240 
   306 
   241 
   307 
       
   308 !
       
   309 
       
   310 update:something with:aParameter from:aModel
       
   311 
       
   312     self dependents do:[:aDependent|
       
   313         aDependent update:something with:aParameter from:aModel
       
   314     ]
   242 ! !
   315 ! !
   243 
   316 
   244 !SelectionInTree methodsFor:'enumerating'!
   317 !SelectionInTree methodsFor:'enumerating'!
   245 
   318 
   246 each:something do:aBlock
   319 each:something do:aBlock
   267     "Travers the tree and build a new list."
   340     "Travers the tree and build a new list."
   268 
   341 
   269     list := OrderedCollection new.
   342     list := OrderedCollection new.
   270 
   343 
   271     root notNil ifTrue:[
   344     root notNil ifTrue:[
   272         showRoot ifTrue:[
   345         showRoot ifTrue:[   
   273             list add:root
   346             list add:root
   274         ].
   347         ].
   275         root recomputeList:list
   348         root recomputeList:list
   276     ].
   349     ].
   277     self changed:#list.
   350     self changed:#list.
   333 ! !
   406 ! !
   334 
   407 
   335 !SelectionInTree class methodsFor:'documentation'!
   408 !SelectionInTree class methodsFor:'documentation'!
   336 
   409 
   337 version
   410 version
   338     ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTree.st,v 1.8 1998-02-13 13:56:35 ca Exp $'
   411     ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTree.st,v 1.9 1998-02-14 16:15:32 tz Exp $'
   339 ! !
   412 ! !