From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:48:50 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>FieldValidation2Example</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none productCode validCodes <imports></imports> <category>Examples-Help</category> <attributes> <package>FieldValidation2-Example</package> </attributes> </class> <comment> Examples.FieldValidation2Example
FieldValidation2Example demonstrates completing a valid field entry based on initial characters entered.
</comment> <methods> Examples.FieldValidation2Example <category>change messages</category>
codeChanged "The code entry was changed -- if the (partial) entry uniquely identifies a valid product code, fill in the rest of the code for the user." | entry qualifiedCodes holder | holder := self productCode. entry := holder value. entry := entry, '*'. qualifiedCodes := OrderedCollection new. self validCodes do: [ :code | (entry match: code) ifTrue: [qualifiedCodes add: code]]. qualifiedCodes size == 1 ifTrue: [ holder retractInterestsFor: self. holder value: qualifiedCodes first. holder onChangeSend: #codeChanged to: self].
</methods> <methods> Examples.FieldValidation2Example <category>intialize-release</category>
initialize validCodes := Set new. validCodes add: 'SPARC10'; add: 'APPLEMAC'; add: 'HP700'; add: 'IBMPC'.
</methods> <methods> Examples.FieldValidation2Example <category>interface opening</category>
postBuildWith: aBuilder "Ask the field's controller to accept continuously -- that is, to return the entry to the model after each keystroke." | ctrlr | self productCode onChangeSend: #codeChanged to: self. ctrlr := (aBuilder componentAt: #codeField) widget controller. ctrlr continuousAccept: true.
</methods> <methods> Examples.FieldValidation2Example <category>aspects</category>
productCode "This method was generated by UIDefiner. The initialization provided below may have been preempted by an initialize method." ^productCode isNil ifTrue: [productCode := String new asValue] ifFalse: [productCode]
validCodes ^validCodes
</methods> <methods> Examples.FieldValidation2Example class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'FieldValidation2Example' #min: #(#Point 196 106 ) #max: #(#Point 196 106 ) #bounds: #(#Rectangle 505 480 701 586 ) ) #component: #(#SpecCollection #collection: #( #(#InputFieldSpec #layout: #(#Rectangle 45 16 144 42 ) #name: #codeField #model: #productCode ) #(#LabelSpec #layout: #(#Point 19 48 ) #label: 'Valid partial entry' ) #(#LabelSpec #layout: #(#Point 8 67 ) #label: 'is completed for you' ) #(#LabelSpec #layout: #(#Point 24 84 ) #label: '(Try S, A, H or I)' ) ) ) )
</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>