ProtocolAdaptor.st
changeset 125 fa5b5e4336bf
parent 114 e577a2f332d0
child 129 f890eaabc487
--- a/ProtocolAdaptor.st	Thu Nov 23 11:40:23 1995 +0100
+++ b/ProtocolAdaptor.st	Thu Nov 23 11:43:41 1995 +0100
@@ -10,8 +10,6 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:2.10.5 on 9-may-1995 at 12:03:43 pm'!
-
 ValueModel subclass:#ProtocolAdaptor
 	 instanceVariableNames:'accessPath subject subjectChannel subjectSendsUpdates'
 	 classVariableNames:''
@@ -35,10 +33,6 @@
 "
 !
 
-version
-    ^ '$Header: /cvs/stx/stx/libview2/ProtocolAdaptor.st,v 1.7 1995-11-11 16:04:56 cg Exp $'
-!
-
 documentation
 "
     a ProtocolAdaptor allows access to embeded values in a
@@ -96,6 +90,10 @@
 	a subjectChannel:model.
 	a value   
 "
+!
+
+version
+    ^ '$Header: /cvs/stx/stx/libview2/ProtocolAdaptor.st,v 1.8 1995-11-23 10:42:39 cg Exp $'
 ! !
 
 !ProtocolAdaptor class methodsFor:'instance creation'!
@@ -108,14 +106,14 @@
     ^ (self new) subject:anObject
 !
 
+subject:anObject accessPath:aCollectionOfSelectors
+    ^ (self new) subject:anObject; accessPath:aCollectionOfSelectors
+!
+
 subject:anObject sendsUpdates:aBoolean
     ^ (self new) subject:anObject; sendsUpdates:aBoolean
 !
 
-subject:anObject accessPath:aCollectionOfSelectors
-    ^ (self new) subject:anObject; accessPath:aCollectionOfSelectors
-!
-
 subject:anObject sendsUpdates:aBoolean accessPath:aCollectionOfSelectors
     ^ (self new) subject:anObject; sendsUpdates:aBoolean; accessPath:aCollectionOfSelectors
 !
@@ -124,20 +122,33 @@
     ^ (self new) subjectChannel:aValueHolder
 !
 
+subjectChannel:aValueHolder accessPath:aCollectionOfSelectors
+    ^ (self new) subjectChannel:aValueHolder; accessPath:aCollectionOfSelectors
+!
+
 subjectChannel:aValueHolder sendsUpdates:aBoolean 
     ^ (self new) subjectChannel:aValueHolder; sendsUpdates:aBoolean
 !
 
-subjectChannel:aValueHolder accessPath:aCollectionOfSelectors
-    ^ (self new) subjectChannel:aValueHolder; accessPath:aCollectionOfSelectors
-!
-
 subjectChannel:aValueHolder sendsUpdates:aBoolean accessPath:aCollectionOfSelectors
     ^ (self new) subjectChannel:aValueHolder; sendsUpdates:aBoolean; accessPath:aCollectionOfSelectors
 ! !
 
 !ProtocolAdaptor methodsFor:'accessing'!
 
+setValue:newValue
+    "set the value in my subject or subjectChannel."
+
+    |obj|
+
+    subject notNil ifTrue:[
+	obj := subject.
+    ] ifFalse:[
+	obj := subjectChannel value
+    ].
+    ^ self setValue:newValue usingSubject:obj
+!
+
 setValue:newValue usingSubject:anObject
     "set a value in anObject, using the selectors in accessPath.
      A helper for setValue:."
@@ -164,6 +175,19 @@
     ^ newValue
 !
 
+value
+    "return the value from my subject or subjectChannel."
+
+    |obj|
+
+    subject notNil ifTrue:[
+	obj := subject.
+    ] ifFalse:[
+	obj := subjectChannel value
+    ].
+    ^ self valueUsingSubject:obj
+!
+
 valueUsingSubject:anObject
     "return the value from anObject, using the selectors in accessPath.
      A helper for value."
@@ -181,84 +205,35 @@
 	].
     ].
     ^ obj
-!
-
-value
-    "return the value from my subject or subjectChannel."
-
-    |obj|
-
-    subject notNil ifTrue:[
-	obj := subject.
-    ] ifFalse:[
-	obj := subjectChannel value
-    ].
-    ^ self valueUsingSubject:obj
-!
-
-setValue:newValue
-    "set the value in my subject or subjectChannel."
-
-    |obj|
-
-    subject notNil ifTrue:[
-	obj := subject.
-    ] ifFalse:[
-	obj := subjectChannel value
-    ].
-    ^ self setValue:newValue usingSubject:obj
-! !
-
-!ProtocolAdaptor ignoredMethodsFor:'change notification'!
-
-notifyChange
-    subjectSendsUpdates ifFalse:[
-	super notifyChange:#value
-    ]
-! !
-
-!ProtocolAdaptor methodsFor:'change notification'!
-
-changed:aspect
-    subjectSendsUpdates ifFalse:[
-	super changed:aspect
-    ]
-! !
-
-!ProtocolAdaptor methodsFor:'initialization'!
-
-initialize
-    super initialize.
-    subjectSendsUpdates := false. 
-! !
-
-!ProtocolAdaptor methodsFor:'change & update'!
-
-update:something with:aPArameter from:changedObject
-    "translate updates from my subject into value-changes towards
-     my dependents. Since I have no specific aspect, every change is forwarded"
-
-    (changedObject == subject
-    or:[changedObject == subjectChannel]) ifTrue:[
-	self changed:#value.
-	^ self
-    ].
 ! !
 
 !ProtocolAdaptor methodsFor:'accessing-spec'!
 
-subjectSendsUpdates
-    "return true, if the subject sends updates itself
-     If true, the receiver will not send updates on changes"
+accessPath
+    ^ accessPath
+!
 
-    ^ subjectSendsUpdates
+accessPath:aCollectionOfSelectors
+    accessPath := aCollectionOfSelectors
+!
+
+subject
+    ^ subject
 !
 
-subjectSendsUpdates:aBoolean
-    "set/clear the flag which states if the subject sends updates itself.
-     If true, the receiver will not send updates on changes"
+subject:anObject
+    subject notNil ifTrue:[
+	subject removeDependent:self
+    ].
+    subject := anObject.
+    self changed:#value.
+    subject notNil ifTrue:[
+	subject addDependent:self
+    ].
+!
 
-    subjectSendsUpdates := aBoolean.
+subjectChannel
+    ^ subjectChannel
 !
 
 subjectChannel:aValueHolder
@@ -279,30 +254,45 @@
     "Modified: 6.9.1995 / 01:19:27 / claus"
 !
 
-subjectChannel
-    ^ subjectChannel
+subjectSendsUpdates
+    "return true, if the subject sends updates itself
+     If true, the receiver will not send updates on changes"
+
+    ^ subjectSendsUpdates
 !
 
-subject:anObject
-    subject notNil ifTrue:[
-	subject removeDependent:self
-    ].
-    subject := anObject.
-    self changed:#value.
-    subject notNil ifTrue:[
-	subject addDependent:self
-    ].
-!
+subjectSendsUpdates:aBoolean
+    "set/clear the flag which states if the subject sends updates itself.
+     If true, the receiver will not send updates on changes"
 
-subject
-    ^ subject
-!
-
-accessPath:aCollectionOfSelectors
-    accessPath := aCollectionOfSelectors
-!
-
-accessPath
-    ^ accessPath
+    subjectSendsUpdates := aBoolean.
 ! !
 
+!ProtocolAdaptor methodsFor:'change & update'!
+
+update:something with:aPArameter from:changedObject
+    "translate updates from my subject into value-changes towards
+     my dependents. Since I have no specific aspect, every change is forwarded"
+
+    (changedObject == subject
+    or:[changedObject == subjectChannel]) ifTrue:[
+	self changed:#value.
+	^ self
+    ].
+! !
+
+!ProtocolAdaptor methodsFor:'change notification'!
+
+changed:aspect
+    subjectSendsUpdates ifFalse:[
+	super changed:aspect
+    ]
+! !
+
+!ProtocolAdaptor methodsFor:'initialization'!
+
+initialize
+    super initialize.
+    subjectSendsUpdates := false. 
+! !
+