Oops, sorry. Jetlag ... Here is what happens in the first callback to fillin the 2nd pane. Note that it adds a callback to fill in the 3rd pane (and this pattern repeats itself). The code is in the Squeaksource AspectMaps repository, if you want to see everything.
AspectMapsUI>>projectSelectFrom: aFilename forWizard: aWizard andConfig: aConfigCollection | psPane stream pnames projname |
"aFilename is first processed to extract the names of the eclipse projects" pnames := OrderedCollection new. stream := (CrLfFileStream fileNamed: aFilename). stream position: 0. stream nextLine. "skip 'Projects list'" [((projname := stream nextLine) = '')not] whileTrue:[pnames add: projname]. stream close. aConfigCollection removeAll. psPane := aWizard wizardPanes at: 2. psPane removeAllParts. pnames do: [ :name | | cbx config| config := AMImportConfig new projectName: name. aConfigCollection add: config. cbx := CheckboxPart new label: name. cbx defaultValue: config doImport. cbx callback: [ :state | config doImport: state. self changeJavaSourcePaneOf: aWizard with: aConfigCollection.]. psPane row: cbx associatedTo: name.].
On 18 Oct 2011, at 11:26, Alexandre Bergel wrote:
Humm... I do not really understand what #projectSelectFrom: fileName forWizard: wizard andConfig: importConfigs is supposed to do.
How does the callback to modify the two panes?
Alexandre
On 17 Oct 2011, at 23:45, Johan Fabry wrote:
Hi Alex.
I had similar problems for AspectMaps and was also surprised that Merlin did not have built-in flow of data between different panes. So I built a hack. What I do is to initialize the second pane with dummy data, and then have a callback of the first pane replace the dummy data with real data. The code that does this is below:
AspectMapsUI >>importWizard
"Second pane contents is actually built using callback of first pane" "Third pane contents is actually built using callback of second pane" | wizard aiPane psPane javaPane resultPane labelPart filePart importConfigs | wizard := WizardControl new.
importConfigs := OrderedCollection new.
" == aspect info pane == " aiPane := WizardFirstPane named: 'Please choose a .xcr aspect file.'. filePart := (ChooseFilePart new) validExtensions: #(xcr). filePart callback: [:fileName | self projectSelectFrom: fileName forWizard: wizard andConfig: importConfigs ]. aiPane row: filePart associatedTo: #aspectInfoFile. wizard addPane: aiPane.
"== project select pane =="
psPane := WizardMiddlePane named: 'Please select which projects to import'. psPane row: (LabelPart on: 'This will be removed by the callback'). wizard addPane: psPane.
"== java source select pane =="
javaPane := WizardMiddlePane named: 'Please provide Java data'. javaPane row: (LabelPart on: 'This will be removed by the callback'). wizard addPane: javaPane.
" == last pane with report of what will be done == "
resultPane := WizardLastPane named: 'Will Import'. javaPane row: (LabelPart on: 'This will be removed by the callback'). wizard addPane: resultPane.
wizard atEndDo: [ :outDict | self importProjects: importConfigs aspects: (outDict at: #aspectInfoFile) ]; open
On 17 Oct 2011, at 10:50, Alexandre Bergel wrote:
Hi!
I am building a wizard and I am stopped on something that looks trivial.
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry jfabry@dcc.uchile.cl - http://dcc.uchile.cl/~jfabry PLEIAD Lab - Computer Science Department (DCC) - University of Chile
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry jfabry@dcc.uchile.cl - http://dcc.uchile.cl/~jfabry PLEIAD Lab - Computer Science Department (DCC) - University of Chile