--- a/ListModelView.st Fri Jul 09 21:11:55 1999 +0200
+++ b/ListModelView.st Sat Jul 10 13:10:55 1999 +0200
@@ -177,7 +177,11 @@
list:aList
"set the list of items
"
- |size changed negatedOrg|
+ |size changed negatedOrg sensor|
+
+ (sensor := self sensor) notNil ifTrue:[
+ sensor flushUserEventsFor:self withType:#syncUpdate:with:.
+ ].
changed := false.
@@ -545,41 +549,60 @@
!
-update:what with:aPara from:chgObj
- "catch and handle any notification raised from the list model
- or list holder
+syncUpdate:what with:args
+ "handle synchronous change
"
- |arg1 arg2|
-
- chgObj ~~ list ifTrue:[
- chgObj == listHolder ifTrue:[self list:(listHolder value)]
- ifFalse:[super update:what with:aPara from:chgObj].
- ^ self
- ].
+ |a1 a2|
- aPara isCollection ifFalse:[
- what == #at: ifTrue:[ ^ self lineChangedAt:aPara with:nil].
- what == #insert: ifTrue:[ ^ self listChangedInsert:aPara nItems:1 ].
- what == #remove: ifTrue:[ ^ self listChangedRemove:aPara toIndex:aPara ].
-
- ^ self
- ].
+ args isCollection ifFalse:[
+ what == #at: ifTrue:[self lineChangedAt:args with:nil]
+ ifFalse:[what == #insert: ifTrue:[self listChangedInsert:args nItems:1]
+ ifFalse:[what == #remove: ifTrue:[self listChangedRemove:args toIndex:args]]]
+ ] ifTrue:[
+ a1 := args at:1.
+ a2 := args at:2.
- arg1 := aPara at:1.
- arg2 := aPara at:2.
-
- what == #at: ifTrue:[ ^ self lineChangedAt:arg1 with:arg2 ].
- what == #insertCollection: ifTrue:[ ^ self listChangedInsert:arg1 nItems:arg2 ].
- what == #removeFrom: ifTrue:[ ^ self listChangedRemove:arg1 toIndex:arg2 ].
-
- what == #replace: ifTrue:[
- arg1 to:arg2 do:[:i| self lineChangedAt:i with:nil ]
+ what == #at: ifTrue:[self lineChangedAt:a1 with:a2]
+ ifFalse:[what == #insertCollection: ifTrue:[self listChangedInsert:a1 nItems:a2]
+ ifFalse:[what == #removeFrom: ifTrue:[self listChangedRemove:a1 toIndex:a2]
+ ifFalse:[what == #replace: ifTrue:[
+ a1 to:a2 do:[:i|self lineChangedAt:i with:nil]
+ ]]]]
]
+!
+
+update:what with:aPara from:chgObj
+ "catch and handle any notification raised from the list model
+ or list holder
+ "
+ chgObj ~~ list ifTrue:[
+ chgObj == listHolder ifTrue:[
+ self pushEvent:#list: with:(listHolder value)
+ ] ifFalse:[
+ super update:what with:aPara from:chgObj
+ ].
+ ^ self
+ ].
+
+ ( #( insert:
+ remove:
+ removeFrom:
+ insertCollection:
+ at:
+ replace:
+ ) includes:what
+ ) ifTrue:[
+ (aPara isCollection and:[(aPara at:2) == list size]) ifTrue:[
+ self pushEvent:#list: with:list
+ ] ifFalse:[
+ self pushEvent:#syncUpdate:with: with:what with:aPara
+ ]
+ ]
! !
!ListModelView methodsFor:'drawing'!
@@ -1264,6 +1287,6 @@
!ListModelView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.10 1999-07-06 16:48:46 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.11 1999-07-10 11:10:55 cg Exp $'
! !
ListModelView initialize!