author | Claus Gittinger <cg@exept.de> |
Tue, 16 Apr 1996 12:15:42 +0200 | |
changeset 536 | fd1b723e69b6 |
parent 526 | 8203430fbadd |
child 537 | 21fc632b22fe |
permissions | -rw-r--r-- |
174
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
1 |
" |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
3 |
All Rights Reserved |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
4 |
|
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
5 |
This software is furnished under a license and may be used |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
10 |
hereby transferred. |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
11 |
" |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
12 |
|
114 | 13 |
SelectionInList subclass:#MultiSelectionInList |
526
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
14 |
instanceVariableNames:'' |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
15 |
classVariableNames:'' |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
16 |
poolDictionaries:'' |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
17 |
category:'Interface-Support-Models' |
114 | 18 |
! |
19 |
||
174
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
20 |
!MultiSelectionInList class methodsFor:'documentation'! |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
21 |
|
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
22 |
copyright |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
23 |
" |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
25 |
All Rights Reserved |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
26 |
|
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
27 |
This software is furnished under a license and may be used |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
28 |
only in accordance with the terms of that license and with the |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
29 |
inclusion of the above copyright notice. This software may not |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
30 |
be provided or otherwise made available to, or used by, any |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
31 |
other person. No title to or ownership of the software is |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
32 |
hereby transferred. |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
33 |
" |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
34 |
! |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
35 |
|
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
36 |
documentation |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
37 |
" |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
38 |
Like a selectionInList, but allows for multiple selected items. |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
39 |
For use as a model for SelectionInListViews, with multipleSelectOk set to true. |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
40 |
" |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
41 |
! ! |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
42 |
|
526
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
43 |
!MultiSelectionInList methodsFor:'accessing-values'! |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
44 |
|
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
45 |
selection |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
46 |
"return the selections value (i.e. the entry in the list" |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
47 |
|
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
48 |
|l| |
166 | 49 |
|
526
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
50 |
l := self list. |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
51 |
^ selectionIndexHolder value collect:[:index | |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
52 |
l at:index |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
53 |
] |
166 | 54 |
|
526
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
55 |
"Created: 26.10.1995 / 16:52:27 / cg" |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
56 |
! |
166 | 57 |
|
58 |
selection:anObjectList |
|
59 |
"set the selection to be anObjectList." |
|
60 |
||
61 |
|l indizes| |
|
62 |
||
63 |
l := self list. |
|
64 |
indizes := OrderedCollection new. |
|
65 |
anObjectList do:[:o | |
|
66 |
|idx| |
|
67 |
||
68 |
idx := l indexOf:o ifAbsent:0. |
|
69 |
idx ~~ 0 ifTrue:[ |
|
70 |
indizes add:idx |
|
71 |
]. |
|
72 |
]. |
|
73 |
^ self selectionIndex:indizes |
|
74 |
||
75 |
"Created: 26.10.1995 / 16:40:24 / cg" |
|
526
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
76 |
! ! |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
77 |
|
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
78 |
!MultiSelectionInList methodsFor:'initialization'! |
166 | 79 |
|
526
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
80 |
initialize |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
81 |
self listHolder:(nil asValue). "/ could also use an empty collection here |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
82 |
self selectionIndexHolder:(Array new asValue). |
166 | 83 |
|
526
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
84 |
"Created: 26.10.1995 / 16:30:22 / cg" |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
85 |
! ! |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
86 |
|
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
87 |
!MultiSelectionInList methodsFor:'private'! |
166 | 88 |
|
526
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
89 |
clearSelection |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
90 |
selectionIndexHolder setValue:(Array new). |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
91 |
|
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
92 |
|
166 | 93 |
! ! |
94 |
||
114 | 95 |
!MultiSelectionInList methodsFor:'selections'! |
96 |
||
97 |
selections |
|
98 |
|selectionIndices| |
|
99 |
||
293 | 100 |
selectionIndices := selectionIndexHolder value. |
536 | 101 |
(selectionIndices isNil |
102 |
or:[selectionIndices == 0 |
|
103 |
or:[selectionIndices isEmpty]]) ifFalse:[ |
|
104 |
^ selectionIndices collect:[:index | listHolder value at:index] |
|
114 | 105 |
]. |
360
c057423ecdd0
literal array overwrite fixed
Claus Gittinger <cg@exept.de>
parents:
293
diff
changeset
|
106 |
^ Array new |
536 | 107 |
|
108 |
"Modified: 16.4.1996 / 12:15:34 / cg" |
|
114 | 109 |
! ! |
110 |
||
526
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
111 |
!MultiSelectionInList class methodsFor:'documentation'! |
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
112 |
|
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
113 |
version |
536 | 114 |
^ '$Header: /cvs/stx/stx/libwidg/MultiSelectionInList.st,v 1.8 1996-04-16 10:15:42 cg Exp $' |
526
8203430fbadd
oops - clearing selection was wrong in MultiSelectionInList
ca
parents:
360
diff
changeset
|
115 |
! ! |