TypeConverter.st
changeset 1199 623c4cfe253d
parent 1197 8e88ffde4374
child 1265 674c985b288b
equal deleted inserted replaced
1198:b10129322a0c 1199:623c4cfe253d
   735      Invalid strings (i.e. empty) are converted to nil.
   735      Invalid strings (i.e. empty) are converted to nil.
   736      This is a very special converter (for the GUI builder) 
   736      This is a very special converter (for the GUI builder) 
   737      - probably not belonging to here"
   737      - probably not belonging to here"
   738 
   738 
   739     self
   739     self
   740         getBlock:[:model |
   740         getBlock:[:model | |v s|
   741                      model value storeString , ' "' , model value class name , '" '
   741                      v := model value.
       
   742                      v isNil ifTrue:[
       
   743                         s := ''
       
   744                      ] ifFalse:[
       
   745                             s := v storeString.
       
   746                             (v isString or:[v isNumber]) ifFalse:[
       
   747                                 s := s , ' "' , v class name , '" '
       
   748                             ]
       
   749                      ].
       
   750                      s
   742                  ]
   751                  ]
   743 
   752 
   744         putBlock:
   753         putBlock:
   745                 [:model :string |
   754                 [:model :string |
   746 
   755 
   747                     |value|
   756                     |value|
   748 
   757 
   749                     value := Object readFrom:string onError:nil.
   758                     string size > 0 ifTrue:[
   750                     value isNil ifTrue:[
   759                         value := Object readFrom:string onError:nil.
   751                         string size > 0 ifTrue:[
   760                         value isNil ifTrue:[
   752                             value := string
   761                             string size > 0 ifTrue:[
   753                         ]
   762                                 value := string
       
   763                             ]
       
   764                         ].
   754                     ].
   765                     ].
   755                     model value:value
   766                     model value:value
   756                 ]
   767                 ]
   757 
   768 
   758         updateBlock: [:m :a :p | true]
   769         updateBlock: [:m :a :p | true]
   891 ! !
   902 ! !
   892 
   903 
   893 !TypeConverter class methodsFor:'documentation'!
   904 !TypeConverter class methodsFor:'documentation'!
   894 
   905 
   895 version
   906 version
   896     ^ '$Header: /cvs/stx/stx/libview2/TypeConverter.st,v 1.26 1999-07-08 09:28:22 cg Exp $'
   907     ^ '$Header: /cvs/stx/stx/libview2/TypeConverter.st,v 1.27 1999-07-09 19:47:07 cg Exp $'
   897 ! !
   908 ! !