This is sort of an observation/question post -- should be interesting to some,
strange and obtuse to others. I appologize if I confuse people with my rambling.
Okay, to date I've made a very slick navigation interface for my Seaside webapp
using a WAPath to 'bookmark' the users progress within a WATask. My WATask
produces continuation objects, which it adds to the WAPath, and these allow the
user to step backwards in the WATask progression.
Clear? In brief the user gets a navigation path that represents his path through
a WATask.
I.e.
Select View >> Custom View >> Report Results (if the user selects and builds a
Custom view)
Select View >> Report Results (if the user selects a prefab view)
The WATasks go method is included at the end of this post if it helps you to
understand what I mean.
This navigation method works flawlessly IF, and only IF, all the continuations
placed on the path are produced only within the WATasks method (i.e. -- if you
invoke a subtask, any anchors it adds to the path become invalidated once the
subtask answers.
Originally, I had thought that this had something to do with answer
continuations from seaside, somehow surviving with the subtask and causing the
subtask to return immediately again once I'd invoked a continuation that would
return us to within that subtask -- but now I think the problem is much simpler:
Since subtasks involve a call/answer method using continuations, once you invoke
that answer continuation, its like you never made the call in the first place --
so my continuation produced by the subtask probably gets garbage collected.
If this is the case, that kind of sucks (in a program compositional way), since
I can't split my task into reusable subtasks and still use this navigational
methodology (and this navigational methodology is really too awesome for words)
-- UNLESS there is a way to call/answer from one task to a child task without
using continuations.
So my question is: "Is there a way for one WATask to use another WATask without
using call/response?", and also "Is my conclusion in the previous previous
correct -- is my inner task continuation being invalidated by the overarching
call/answer continuation invokation?"
(go method follows signature)
Cheers,
Warren Wilkinson
go
| reader filter mypath collection |
mypath := self path.
self path empty.
filter := self call: (Continuation currentDo: [:nextStep |
mypath pushSegment: (Array with: nextStep with: [BMViewList new path: self
path; yourself]) name: 'Select Filter'.
nextStep value: (BMViewList new path: self path; yourself).]).
"No filter given, so use must have clicked Custom Filter."
filter = nil ifTrue: [
filter := self call: (Continuation currentDo: [:nextStep |
mypath pushSegment: (Array with: nextStep with: [(EmployeeReportRequirements
new asComponent) addValidatedForm; yourself]) name: 'Custom Filter'.
nextStep value: ((EmployeeReportRequirements new asComponent)
addValidatedForm; yourself).]).
].
"Still no filter, user must have canceled custom filter"
filter = nil ifTrue: [^nil].
"Generate a reader for filtered data."
collection := self session root at: 'survey'.
reader := BMUtil createFilteredReaderFromCollection: collection filters: filter.
self call: (Continuation currentDo: [:nextStep |
mypath pushSegment: [nextStep value: (BMViewComponent new reader: reader)]
name: 'Results'.
nextStep value: (BMViewComponent new reader: reader)]).