MultiSelectionInList.st
changeset 579 a9188bedbfb9
parent 563 fa563ad7630c
child 583 2ec13b7ceba5
equal deleted inserted replaced
578:5b82bc433c14 579:a9188bedbfb9
    62 selection:anObjectList 
    62 selection:anObjectList 
    63     "set the selection to be anObjectList."
    63     "set the selection to be anObjectList."
    64 
    64 
    65     |l indizes|
    65     |l indizes|
    66 
    66 
       
    67     "/
       
    68     "/ for your convenience: allow 0 and nil as empty
       
    69     "/ selections
       
    70     "/
       
    71     (anObjectList isNil or:[anObjectList == 0]) ifTrue:[
       
    72         ^ self selectionIndex:#()
       
    73     ].
       
    74 
    67     l := self list.
    75     l := self list.
    68     l isNil ifTrue:[^ self].   "/ mhmh - no list; what should we do here ?
    76     l isNil ifTrue:[^ self].   "/ mhmh - no list; what should we do here ?
    69 
    77 
    70     indizes := OrderedCollection new.
    78     indizes := OrderedCollection new.
    71     anObjectList do:[:o |
    79     anObjectList do:[:o |
    77         ].
    85         ].
    78     ].
    86     ].
    79     ^ self selectionIndex:indizes
    87     ^ self selectionIndex:indizes
    80 
    88 
    81     "Created: 26.10.1995 / 16:40:24 / cg"
    89     "Created: 26.10.1995 / 16:40:24 / cg"
    82     "Modified: 16.4.1996 / 15:53:03 / cg"
    90     "Modified: 25.4.1996 / 09:07:44 / cg"
    83 ! !
    91 ! !
    84 
    92 
    85 !MultiSelectionInList methodsFor:'queries'!
    93 !MultiSelectionInList methodsFor:'queries'!
    86 
    94 
    87 zeroIndex
    95 zeroIndex
    94 ! !
   102 ! !
    95 
   103 
    96 !MultiSelectionInList methodsFor:'selections'!
   104 !MultiSelectionInList methodsFor:'selections'!
    97 
   105 
    98 selections
   106 selections
       
   107     "obsolete - almost the same as selection"
       
   108 
    99     |selectionIndices|
   109     |selectionIndices|
       
   110 
       
   111     self obsoleteMethodWarning.
   100 
   112 
   101     selectionIndices := selectionIndexHolder value.
   113     selectionIndices := selectionIndexHolder value.
   102     (selectionIndices isNil
   114     (selectionIndices isNil
   103      or:[selectionIndices == 0     
   115      or:[selectionIndices == 0     
   104      or:[selectionIndices isEmpty]]) ifFalse:[
   116      or:[selectionIndices isEmpty]]) ifFalse:[
   105         ^ selectionIndices collect:[:index | listHolder value at:index]
   117         ^ selectionIndices collect:[:index | listHolder value at:index]
   106     ].
   118     ].
   107     ^ Array new
   119     ^ Array new
   108 
   120 
   109     "Modified: 20.4.1996 / 13:13:21 / cg"
   121     "Modified: 25.4.1996 / 09:09:45 / cg"
   110 ! !
   122 ! !
   111 
   123 
   112 !MultiSelectionInList class methodsFor:'documentation'!
   124 !MultiSelectionInList class methodsFor:'documentation'!
   113 
   125 
   114 version
   126 version
   115     ^ '$Header: /cvs/stx/stx/libwidg/MultiSelectionInList.st,v 1.10 1996-04-20 13:54:48 cg Exp $'
   127     ^ '$Header: /cvs/stx/stx/libwidg/MultiSelectionInList.st,v 1.11 1996-04-25 07:56:58 cg Exp $'
   116 ! !
   128 ! !