From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:47: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>List1Example</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none classes methodNames instances <imports></imports> <category>Examples-Help</category> <attributes> <package>List1-Example</package> </attributes> </class> <comment> Examples.List1Example
List1Example demonstrates the use of a list widget to populate dependent Lists.
</comment> <methods> Examples.List1Example <category>menu messages</category>
browse "Open a method browser on the selected methods." | chosenSelectors cls array | chosenSelectors := self methodNames selections. cls := self classes selection. "If no method names are selected, abort." chosenSelectors isEmpty ifTrue: [^self]. "Convert the selector names to MethodDefinitions for the class ." array := chosenSelectors collect: [:sel| MethodDefinition class: cls selector: sel]. "Open a browser on the methods." MethodCollector new openListBrowserOn: array label: 'Selected methods in ', cls name initialSelection: chosenSelectors first.
clearAll self methodNames clearAll.
inspectInstance "Open an inspector on the selected instance." | inst | inst := self instances selection. inst isNil ifFalse: [inst inspect].
selectAll self methodNames selectAll.
</methods> <methods> Examples.List1Example <category>change messages</category>
changedClass | cls | self classes selection isNil "No class is selected -- empty the selector list." ifTrue: [ self methodNames list: List new. self instances list: List new] "A class is selected" ifFalse: [ cls := self classes selection. "Update the selectors list." self methodNames list: cls selectors asSortedCollection. "Update the instances list." self instances list: cls allInstances].
</methods> <methods> Examples.List1Example <category>aspects</category>
classes ^classes
instances ^instances
methodNames ^methodNames
</methods> <methods> Examples.List1Example <category>initialize-release</category>
initialize super initialize. classes := SelectionInList with: (Core allClasses asSortedCollection:[:a :b|a name < b name]). classes selectionIndexHolder onChangeSend: #changedClass to: self. methodNames := MultiSelectionInList new. instances := SelectionInList new.
</methods> <methods> Examples.List1Example <category>interface opening</category>
postOpenWith: aBuilder super postOpenWith: aBuilder. "Uncomment the line below to auto-select the first class." self classes selectionIndex: 1. "Uncomment the lines below to auto-select the last class." "self classes selection: self classes list last. (aBuilder componentAt: #classes) widget controller cursorPointWithScrolling." "In the classes list, use boxed highlighting instead of reverse-video." (aBuilder componentAt: #classes) widget strokedSelection.
</methods> <methods> Examples.List1Example class <category>resources</category>
instancesMenu "UIMenuEditor new openOnClass: self andSelector: #instancesMenu" <resource: #menu> ^#(#Menu #(#(#MenuItem #label: 'inspect' ) ) #(1 ) #(#inspectInstance ) ) decodeAsLiteralArray
selectorsMenu "UIMenuEditor new openOnClass: self andSelector: #selectorsMenu" <resource: #menu> ^#(#Menu #( #(#MenuItem #label: 'select all' ) #(#MenuItem #label: 'clear all' ) #(#MenuItem #label: 'browse' ) ) #(2 1 ) #(#selectAll #clearAll #browse ) ) decodeAsLiteralArray
</methods> <methods> Examples.List1Example class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'List1Example' #min: #(#Point 50 50 ) #max: #(#Point 1128 900 ) #bounds: #(#Rectangle 275 217 648 594 ) ) #component: #(#SpecCollection #collection: #( #(#SequenceViewSpec #layout: #(#LayoutFrame 1 0 40 0 0 0.5 -1 1 ) #name: #classes #model: #classes ) #(#LabelSpec #layout: #(#Point 5 20 ) #label: 'Classes' ) #(#SequenceViewSpec #layout: #(#LayoutFrame 1 0.5 40 0 -1 1 0 0.5 ) #name: #methodNames #model: #methodNames #menu: #selectorsMenu #multipleSelections: true #useModifierKeys: true ) #(#LabelSpec #layout: #(#LayoutOrigin 5 0.5 20 0 ) #label: 'Selectors' ) #(#SequenceViewSpec #layout: #(#LayoutFrame 1 0.5 30 0.5 -1 1 -1 1 ) #model: #instances #menu: #instancesMenu ) #(#LabelSpec #layout: #(#LayoutOrigin 5 0.5 10 0.5 ) #label: 'Instances' ) ) ) )
</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>