author | Claus Gittinger <cg@exept.de> |
Thu, 18 Jan 1996 01:11:18 +0100 | |
changeset 295 | aa5887bff1b2 |
parent 293 | ab897211c99c |
child 360 | c057423ecdd0 |
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 |
'From Smalltalk/X, Version:2.10.5 on 25-mar-1995 at 12:12:09 pm'! |
14 |
||
15 |
SelectionInList subclass:#MultiSelectionInList |
|
16 |
instanceVariableNames:'' |
|
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
129 | 19 |
category:'Interface-Support-Models' |
114 | 20 |
! |
21 |
||
174
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
22 |
!MultiSelectionInList class methodsFor:'documentation'! |
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 |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
25 |
" |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
26 |
COPYRIGHT (c) 1995 by Claus Gittinger |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
27 |
All Rights Reserved |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
28 |
|
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
29 |
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
|
30 |
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
|
31 |
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
|
32 |
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
|
33 |
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
|
34 |
hereby transferred. |
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 |
! |
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 |
version |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
39 |
^ '$Header' |
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 |
documentation |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
43 |
" |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
44 |
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
|
45 |
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
|
46 |
" |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
47 |
! ! |
d80a6cc3f9b2
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
166
diff
changeset
|
48 |
|
166 | 49 |
!MultiSelectionInList methodsFor:'initialization'! |
50 |
||
51 |
initialize |
|
52 |
self listHolder:(nil asValue). "/ could also use an empty collection here |
|
53 |
self selectionIndexHolder:(#() asValue). |
|
54 |
||
55 |
"Created: 26.10.1995 / 16:30:22 / cg" |
|
56 |
! ! |
|
57 |
||
58 |
!MultiSelectionInList methodsFor:'accessing-values'! |
|
59 |
||
60 |
selection:anObjectList |
|
61 |
"set the selection to be anObjectList." |
|
62 |
||
63 |
|l indizes| |
|
64 |
||
65 |
l := self list. |
|
66 |
indizes := OrderedCollection new. |
|
67 |
anObjectList do:[:o | |
|
68 |
|idx| |
|
69 |
||
70 |
idx := l indexOf:o ifAbsent:0. |
|
71 |
idx ~~ 0 ifTrue:[ |
|
72 |
indizes add:idx |
|
73 |
]. |
|
74 |
]. |
|
75 |
^ self selectionIndex:indizes |
|
76 |
||
77 |
"Created: 26.10.1995 / 16:40:24 / cg" |
|
78 |
! |
|
79 |
||
80 |
selection |
|
81 |
"return the selections value (i.e. the entry in the list" |
|
82 |
||
83 |
|l| |
|
84 |
||
85 |
l := self list. |
|
86 |
^ selectionIndexHolder value collect:[:index | |
|
87 |
l at:index |
|
88 |
] |
|
89 |
||
90 |
"Created: 26.10.1995 / 16:52:27 / cg" |
|
91 |
! ! |
|
92 |
||
114 | 93 |
!MultiSelectionInList methodsFor:'selections'! |
94 |
||
95 |
selections |
|
96 |
|selectionIndices| |
|
97 |
||
293 | 98 |
selectionIndices := selectionIndexHolder value. |
114 | 99 |
(selectionIndices isNil |
100 |
or:[selectionIndices isEmpty]) ifFalse:[ |
|
129 | 101 |
^ selectionIndices collect:[:index | listHolder value at:index] |
114 | 102 |
]. |
103 |
^ #() |
|
104 |
! ! |
|
105 |