From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:46:26 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <class> <name>Adaptor2Example</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none customers selectedCustomer <imports></imports> <category>Examples-Help</category> <attributes> <package>Adapt2-Example</package> </attributes> </class> <comment> Examples.Adaptor2Example
Adaptor1Example class demonstrates the use of a value holder and the use of onChangeSend: to coordinate changes with a domain model, Customer1Example. Browse the initialize-release methods for configuring dependencies, and the change messages methods for updating the domain model. Instance Variables: customers <SelectionInList> list model of customers selectedCustomer <ValueHolder on: Customer1Example> selected Customer1Example instance
</comment> <methods> Examples.Adaptor2Example <category>aspects</category>
accountID | adaptor | adaptor := AspectAdaptor subjectChannel: self selectedCustomer. adaptor forAspect: #accountID. adaptor onChangeSend: #redisplayList to: self. ^adaptor
address | adaptor | adaptor := AspectAdaptor subjectChannel: self selectedCustomer. ^adaptor accessWith: #address assignWith: #address:
customers ^customers
name | adaptor | adaptor := AspectAdaptor subjectChannel: self selectedCustomer. adaptor forAspect: #name. adaptor onChangeSend: #redisplayList to: self. ^adaptor
phoneNumber | adaptor | adaptor := AspectAdaptor subjectChannel: self selectedCustomer. adaptor forAspect: #phoneNumber. adaptor subjectSendsUpdates: true. ^adaptor
selectedCustomer ^selectedCustomer
</methods> <methods> Examples.Adaptor2Example <category>actions</category>
add | list selectionInList | selectionInList := self customers. list := selectionInList list. "Add new customer." list add: Customer1Example new. selectionInList list: list. "Highlight new customer." selectionInList selectionIndex: list size.
formatPhoneNumber | chosenCustomer | chosenCustomer := self customers selection. chosenCustomer formatUSPhoneNumber.
</methods> <methods> Examples.Adaptor2Example <category>initialize-release</category>
initialize customers := SelectionInList new. customers selectionIndexHolder onChangeSend: #changedCustomer to: self. selectedCustomer := Customer1Example new asValue.
</methods> <methods> Examples.Adaptor2Example <category>private</category>
redisplayList (self builder componentAt: #customers) widget invalidate.
</methods> <methods> Examples.Adaptor2Example <category>change messages</category>
changedCustomer | chosenCustomer | chosenCustomer := self customers selection. self selectedCustomer value: (chosenCustomer isNil ifTrue: [Customer1Example new] ifFalse: [chosenCustomer]). "Enable/disable selection-sensitive widgets." #( #accountID #name #address #phoneNumber #format) do: [ :componentName | (self builder componentAt: componentName) isEnabled: chosenCustomer notNil].
</methods> <methods> Examples.Adaptor2Example class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'Adaptor2Example' #min: #(#Point 587 188 ) #max: #(#Point 587 188 ) #bounds: #(#Rectangle 558 605 1145 793 ) ) #component: #(#SpecCollection #collection: #( #(#LabelSpec #layout: #(#Point 205 18 ) #label: 'Customer ID' ) #(#LabelSpec #layout: #(#Point 205 55 ) #label: 'Name' ) #(#LabelSpec #layout: #(#Point 205 92 ) #label: 'Address' ) #(#LabelSpec #layout: #(#LayoutOrigin 0 0.349233 0 0.680851 ) #label: 'Phone' ) #(#LabelSpec #layout: #(#Point 318 166 ) #label: '(These fields use AspectAdaptors)' #style: #small ) #(#ActionButtonSpec #layout: #(#AlignmentOrigin 0 0.166667 4 0 0.5 0 ) #model: #add #label: 'Add customer' ) #(#SequenceViewSpec #layout: #(#LayoutFrame 10 0 40 0 0 0.333333 -10 1 ) #name: #customers #flags: 15 #model: #customers ) #(#InputFieldSpec #layout: #(#Rectangle 321 21 368 43 ) #name: #accountID #flags: 40 #model: #accountID #type: #number ) #(#InputFieldSpec #layout: #(#Rectangle 321 56 518 80 ) #name: #name #flags: 40 #model: #name ) #(#InputFieldSpec #layout: #(#Rectangle 321 93 518 117 ) #name: #address #flags: 40 #model: #address ) #(#InputFieldSpec #layout: #(#LayoutFrame 0 0.546848 0 0.68617 0 0.882453 0 0.81383 ) #name: #phoneNumber #flags: 40 #model: #phoneNumber ) #(#ActionButtonSpec #layout: #(#Rectangle 522 129 582 153 ) #name: #format #flags: 40 #model: #formatPhoneNumber #label: 'Format' ) ) ) )
</methods> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>ApplicationModel</name> <environment>UI</environment> <super>UI.Model</super> <private>false</private> none builder uiSession eventHandlers savedWindowInformation <imports></imports> <category>UIBuilder-Framework</category> <attributes> <package>UIBuilder-Framework</package> </attributes> </class>