use inherited functionality
authorClaus Gittinger <cg@exept.de>
Thu, 12 Sep 2002 15:39:15 +0200
changeset 2184 16d3b72ca431
parent 2183 5c69691590eb
child 2185 639d20ab5667
use inherited functionality
ColorMenu.st
FontMenu.st
--- a/ColorMenu.st	Thu Sep 12 15:32:18 2002 +0200
+++ b/ColorMenu.st	Thu Sep 12 15:39:15 2002 +0200
@@ -227,21 +227,18 @@
 
     |holder label|
 
-    aColor isColor 
-    ifFalse:
-    [
+    aColor isColor ifFalse:[
         enabledChannel value:false
-    ] 
-    ifTrue:
-    [
-        self disabledRedrawDo:
-        [                 
-            holder := self colorHolder.     
-            label  := Text string: '   ' emphasis:(#backgroundColor->aColor).
-            enabledChannel value:true.
-            holder label:label.
-            model value: aColor
-        ]
+    ] ifTrue:[
+        self 
+            disabledRedrawDo:
+                [                 
+                    holder := self colorHolder.     
+                    label  := Text string: '   ' emphasis:(#backgroundColor->aColor).
+                    enabledChannel value:true.
+                    holder label:label.
+                    model value: aColor
+                ]
     ]
 !
 
@@ -255,23 +252,12 @@
 
 !ColorMenu methodsFor:'accessing-channels'!
 
-model
-    "get my color channel"
-
-    ^model
-
-
-
-!
-
 model:aValueHolder
     "set my color channel"
 
-    model notNil ifTrue:[model removeDependent:self].
-    model := aValueHolder.
+    super model:aValueHolder.
     model notNil ifTrue:[
-        model addDependent:self.
-        self color: model value
+        self updateFomModel
     ]
 ! !
 
@@ -286,15 +272,8 @@
 
 !ColorMenu methodsFor:'change & update'!
 
-update:something with:aParameter from:changedObject
-    "one of my models changed its value"
-
-    changedObject == model ifTrue:[^self color: model value].
-    super update:something with:aParameter from:changedObject
-
-
-
-
+updateFomModel
+    self color:(model value)
 ! !
 
 !ColorMenu methodsFor:'initialization'!
@@ -913,5 +892,5 @@
 !ColorMenu class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ColorMenu.st,v 1.28 2002-09-12 13:32:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ColorMenu.st,v 1.29 2002-09-12 13:39:13 cg Exp $'
 ! !
--- a/FontMenu.st	Thu Sep 12 15:32:18 2002 +0200
+++ b/FontMenu.st	Thu Sep 12 15:39:15 2002 +0200
@@ -15,7 +15,7 @@
 "{ Package: 'stx:libtool2' }"
 
 MenuPanel subclass:#FontMenu
-	instanceVariableNames:'model enabledChannel fontFamily fontFace fontStyle fontSize'
+	instanceVariableNames:'enabledChannel fontFamily fontFace fontStyle fontSize'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-UIPainter'
@@ -298,36 +298,19 @@
 
 !FontMenu methodsFor:'accessing-channels'!
 
-model
-    "get my model
-    "
-  ^ model
-!
-
 model:aValueHolder
     "set my model
     "
+    super model:aValueHolder.
     model notNil ifTrue:[
-        model removeDependent:self. 
-    ].
-    model := aValueHolder.
-
-    model notNil ifTrue:[
-        model addDependent:self.
-        self fontDescription:(model value)
+        self updateFomModel
     ].
 ! !
 
 !FontMenu methodsFor:'change & update'!
 
-update:something with:aParameter from:changedObject
-    "one of my models changed its value
-    "
-    changedObject == model ifTrue:[
-         ^ self fontDescription:(model value)
-    ].
-    super update:something with:aParameter from:changedObject
-
+updateFomModel
+    self fontDescription:(model value)
 ! !
 
 !FontMenu methodsFor:'initialization'!
@@ -365,5 +348,5 @@
 !FontMenu class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/FontMenu.st,v 1.10 2000-08-21 22:44:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/FontMenu.st,v 1.11 2002-09-12 13:39:15 cg Exp $'
 ! !