UISpecificationTool.st
changeset 428 f87cca33874e
parent 367 5a78ebab56ff
child 536 3991e37ec19f
equal deleted inserted replaced
427:ad235cdacee5 428:f87cca33874e
   399 !
   399 !
   400 
   400 
   401 specification:aSpec
   401 specification:aSpec
   402     "sets current edit specification
   402     "sets current edit specification
   403     "
   403     "
       
   404     self releaseResources.
       
   405 
   404     aSpec isNil ifTrue:[
   406     aSpec isNil ifTrue:[
       
   407         specChannel notNil ifTrue:[ specChannel release ].
       
   408         aspects     notNil ifTrue:[ aspects     release ].
       
   409 
   405         specChannel   := nil.
   410         specChannel   := nil.
   406         specification := nil.
   411         specification := nil.
   407         aspects       := nil.
   412         aspects       := nil.
   408     ] ifFalse:[
   413     ] ifFalse:[
   409         specification class == aSpec class ifTrue:[
   414         specification class == aSpec class ifTrue:[
   410             specification := aSpec.
   415             specification := aSpec.
   411           ^ specChannel value:specification.
   416           ^ specChannel value:specification.
   412         ].
   417         ].
       
   418         specChannel notNil ifTrue:[ specChannel release ].
       
   419         aspects     notNil ifTrue:[ aspects     release ].
       
   420 
   413         specification  := aSpec.
   421         specification  := aSpec.
   414         aspects        := IdentityDictionary new.
   422         aspects        := IdentityDictionary new.
   415         specChannel    := specification asValue.
   423         specChannel    := specification asValue.
   416         specification class addBindingsTo:aspects for:specification channel:specChannel.
   424         specification class addBindingsTo:aspects for:specification channel:specChannel.
   417         aspects do:[:el| el addDependent:self ].
   425         aspects do:[:el| el addDependent:self ].
   475     aspects notNil ifTrue:[
   483     aspects notNil ifTrue:[
   476         ^ aspects at:aKey ifAbsent:nil
   484         ^ aspects at:aKey ifAbsent:nil
   477     ].
   485     ].
   478     ^ super aspectFor:aKey
   486     ^ super aspectFor:aKey
   479 
   487 
       
   488 !
       
   489 
       
   490 releaseResources
       
   491     "release resources
       
   492     "
       
   493     |frame appl|
       
   494 
       
   495     frame := builder componentAt:#Frame.
       
   496     appl  := builder application.
       
   497     builder := UIBuilder new.
       
   498     builder application:appl.
       
   499     builder componentAt:#Frame put:frame.
       
   500 
   480 ! !
   501 ! !
   481 
   502 
   482 !UISpecificationTool methodsFor:'change & update'!
   503 !UISpecificationTool methodsFor:'change & update'!
   483 
   504 
   484 update
   505 update
   514         slices := specification class slices.
   535         slices := specification class slices.
   515         idx:= slices findFirst:[:aSlice| aSlice first = something ].
   536         idx:= slices findFirst:[:aSlice| aSlice first = something ].
   516 
   537 
   517         idx ~~ 0 ifTrue:[
   538         idx ~~ 0 ifTrue:[
   518             spec := specification class perform:((slices at:idx) last).
   539             spec := specification class perform:((slices at:idx) last).
   519         ].
   540         ]
   520     ].
   541     ].
   521 
   542 
   522     spec ~= selection ifTrue:[
   543     spec ~= selection ifTrue:[
       
   544         self releaseResources.
   523         frame := builder componentAt:#Frame.
   545         frame := builder componentAt:#Frame.
   524         frame destroySubViews.
   546         frame destroySubViews.
   525 
   547 
   526         spec notNil ifTrue:[
   548         spec notNil ifTrue:[
   527             builder buildFromSpec:spec in:frame.
   549             builder buildFromSpec:spec in:frame.