From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:47:58 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>Notebook3Example</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none majorKeys minorKeys employeeList departments employees <imports></imports> <category>Examples-Help</category> <attributes> <package>Notebook3-Example</package> </attributes> </class> <comment> Examples.Notebook3Example
Notebook3Example demonstrates a Notebook with two-way dependencies between major and minor tabs.
</comment> <methods> Examples.Notebook3Example <category>change messages</category>
changedDepartment | subdepts sel | sel := self majorKeys selection. sel isNil ifTrue: [^self]. "Display the appropriate subdepartments as minor keys." subdepts := self departments at: sel. self minorKeys list: subdepts. self minorKeys selectionIndex: 1.
changedSubdepartment "Display the appropriate employees in the list." | emps sel | sel := self minorKeys selection. sel isNil ifTrue: [^self]. emps := self employees at: sel. self employeeList list: emps.
</methods> <methods> Examples.Notebook3Example <category>aspects</category>
departments ^departments
employeeList ^employeeList
employees ^employees
majorKeys ^majorKeys
minorKeys ^minorKeys
</methods> <methods> Examples.Notebook3Example <category>initialize-release</category>
initialize self initializeDepartments. self initializeEmployees. majorKeys := SelectionInList with: departments keys asArray. majorKeys selectionIndexHolder onChangeSend: #changedDepartment to: self. minorKeys := SelectionInList new. minorKeys selectionIndexHolder onChangeSend: #changedSubdepartment to: self. employeeList := SelectionInList new.
initializeDepartments "Sample data." departments := Dictionary new: 4. departments add: 'ACCOUNTING' -> #( 'Payables' 'Receivables' 'Payroll' ); add: 'OPERATIONS' -> #( 'Personnel' 'Purchasing' 'Shipping' ); add: 'R&D' -> #( 'Technicians' 'Rocket Scientists' ); add: 'SALES' -> #( 'Inside Reps' 'Field Reps' ).
initializeEmployees "Sample data." employees := Dictionary new: 10. employees add: 'Payables' -> #('Wlodzimierz Adar' 'Steven Beniares' 'Martin Giefer' 'Linda Katzman' 'Jeffrey Lyons' 'Richard McClaughry' 'Elgin Neish' 'David Roy' 'Carl Watts' ); add: 'Receivables' -> #('William Aiello' 'Steve Benjamin' 'Richard Cox' 'Martin Goldberg' 'Lela Keith' 'Jasen Macie' 'Duane Ostler' 'Daniel Rubin' 'Bryan Wersinger' ); add: 'Payroll' -> #('William Alexander' 'Sheryl Berman' 'Richard Cox' 'Margaret Gomez' 'Lee Khaw' 'James Markham' 'Doreen Otto' 'Dalia Rucker' 'Brian Will' ); add: 'Personnel' -> #('William Alpar' 'Sandy Blacow' 'Pippa Dahl' 'Marek Hammons' 'Laurie Krasner' 'Heather Mazon' 'Denise Pellegrini' 'Cindy Sage' 'Brian Yam' ); add: 'Purchasing' -> #('Walter Aver' 'Russ Boucher' 'Phillip Dellinger' 'Marcel Heacock' 'Kristina Kubalski' 'Gordon Middleton' 'Debra Pencin' 'Chris Schelvis' 'Ann Yee' ); add: 'Shipping' -> #('Vicki Aviles' 'Roy Brinkley' 'Patrick Dillman' 'Mallory Hudson' 'Kousaku Lanovaz' 'Glenn Minton' 'Deborah Quisenberry' 'Cheryl Siener' 'Adony Yelland' ); add: 'Technicians' -> #('Timothy Bay' 'Ron Bruzas' 'Patricia Dym' 'Lynn Irao' 'Kenny Lee' 'Frank Mohr' 'Deborah Ranuio' 'Cheryl Smith' 'Adele Yokota' ); add: 'Rocket Scientists' -> #('Terry Bedard' 'Robert Cannon' 'Nancy Field' 'Lorrie Jackson' 'Karen Lee' 'Deborah Morley' 'Frank Reabock' 'Carolyn Taylor' 'Aaron Zdybel' ); add: 'Inside Reps' -> #('Tami Beisheim' 'Robert Carter' 'Michel Fimbres' 'Lisa Jeziorek' 'John Leibs' 'Francisco Rudolph-Nagle' 'David Regan' 'Carolyn Trumbower' ); add: 'Field Reps' -> #('Susan Bellack' 'Richard Chou' 'Michael Forster' 'Lisa Kasson' 'Jodi Lewis' 'Ernest Neal' 'David Rowledge' 'Carlos Utley' ).
</methods> <methods> Examples.Notebook3Example <category>interface opening</category>
postOpenWith: aBuilder | notebook | notebook := (builder componentAt: #pageHolder) widget. "Install the subcanvas." notebook client: self spec: #listSpec. "Display the first page." majorKeys selectionIndex: 1. minorKeys selectionIndex: 1.
</methods> <methods> Examples.Notebook3Example class <category>interface specs</category>
listSpec "UIPainter new openOnClass: self andSelector: #listSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'Unlabeled Canvas' #min: #(#Point 20 20 ) #bounds: #(#Rectangle 446 458 646 658 ) ) #component: #(#SpecCollection #collection: #( #(#SequenceViewSpec #layout: #(#LayoutFrame 1 0 1 0 -1 1 -1 1 ) #model: #employeeList ) ) ) )
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'Notebook3Example' #min: #(#Point 20 20 ) #bounds: #(#Rectangle 356 404 828 748 ) ) #component: #(#SpecCollection #collection: #( #(#NoteBookSpec #layout: #(#LayoutFrame 10 0 40 0 -10 1 -10 1 ) #name: #pageHolder #model: #majorKeys #secondModel: #minorKeys #binderSide: #top #binderWidth: 30 #majorTabsOnRight: false #rightInset: 120 ) #(#LabelSpec #layout: #(#AlignmentOrigin 0 0.5 10 0 0.5 0 ) #label: 'A notebook with interdependent tabs' #style: #large ) ) ) )
</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>