From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:49:22 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>Adaptor7Example</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none customers updateTrigger <imports></imports> <category>Help-Examples</category> <attributes> <package>Adapt7-Example</package> </attributes> </class> <comment> Examples.Adaptor7Example
Adaptor7Example, a variation of example Adaptor3Example, minimizes coding of BufferedValueHolders, AspectAdaptors, and change notification by making use of the application builder to build them from specifications. Instance Variables: customers <SelectionInList> list model of Customer1Example instances updateTrigger <ValueHolder on: Boolean> model updates selected Customer1Example when set true
</comment> <methods> Examples.Adaptor7Example <category>actions</category>
accept self updateTrigger value: true. self redisplayList.
add | list selectionInList | selectionInList := self customers. list := selectionInList list. "Add new customer." list add: Customer1Example new. "Highlight new customer." selectionInList selectionIndex: list size. self changedCustomer.
</methods> <methods> Examples.Adaptor7Example <category>change messages</category>
changedCustomer | chosenCustomer | "Discard changes that were not OK'd." self updateTrigger value: false. "Enable/disable selection-sensitive widgets." chosenCustomer := self customers selection. #( #accountID #name #address #phoneNumber #ok) do: [ :componentName | (self builder componentAt: componentName) isEnabled: chosenCustomer notNil].
</methods> <methods> Examples.Adaptor7Example <category>aspects</category>
customers ^customers
selectedCustomer ^customers selectionHolder
updateTrigger ^updateTrigger
</methods> <methods> Examples.Adaptor7Example <category>initialize-release</category>
initialize customers := SelectionInList new. updateTrigger := false asValue.
</methods> <methods> Examples.Adaptor7Example <category>private</category>
redisplayList (self builder componentAt: #customers) widget invalidate.
</methods> <methods> Examples.Adaptor7Example class <category>interface specs</category>
windowSpec "Tools.UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: 'Adaptor7Example' #min: #(#{Core.Point} 506 201 ) #max: #(#{Core.Point} 506 201 ) #bounds: #(#{Graphics.Rectangle} 800 600 1306 801 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.LabelSpec} #layout: #(#{Core.Point} 175 19 ) #label: 'Customer ID' ) #(#{UI.LabelSpec} #layout: #(#{Core.Point} 175 56 ) #label: 'Name' ) #(#{UI.LabelSpec} #layout: #(#{Core.Point} 175 93 ) #label: 'Address' ) #(#{UI.LabelSpec} #layout: #(#{Core.Point} 175 129 ) #label: 'Phone' ) #(#{UI.LabelSpec} #layout: #(#{Core.Point} 267 169 ) #label: 'BufferedValueHolders)' #style: #small ) #(#{UI.LabelSpec} #layout: #(#{Core.Point} 267 153 ) #label: '(These fields use' #style: #small ) #(#{UI.ActionButtonSpec} #layout: #(#{UI.AlignmentOrigin} 0 0.166667 4 0 0.5 0 ) #model: #add #label: 'Add customer' ) #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.Rectangle} 434 161 483 191 ) #name: #ok #flags: 40 #model: #accept #label: 'OK' #defaultable: true ) #(#{UI.InputFieldSpec} #layout: #(#{Graphics.Rectangle} 286 94 483 118 ) #name: #address #flags: 40 #model: #'selectedCustomer address | updateTrigger' ) #(#{UI.InputFieldSpec} #layout: #(#{Graphics.Rectangle} 286 130 483 154 ) #name: #phoneNumber #flags: 40 #model: #'selectedCustomer phoneNumber | updateTrigger' ) #(#{UI.InputFieldSpec} #layout: #(#{Graphics.Rectangle} 286 22 333 44 ) #name: #accountID #flags: 40 #model: #'selectedCustomer accountID | updateTrigger' #type: #number ) #(#{UI.SequenceViewSpec} #layout: #(#{Graphics.LayoutFrame} 10 0 40 0 0 0.333333 -10 1 ) #name: #customers #flags: 15 #model: #customers #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #valueChangeSelector: #changedCustomer ) ) #(#{UI.InputFieldSpec} #layout: #(#{Graphics.Rectangle} 286 57 483 81 ) #name: #name #flags: 40 #model: #'selectedCustomer name | updateTrigger' ) ) ) )
</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>