I've been having a lot of fun lately playing with woody and flowscript, I must say, flowscript is a mindblowing paradigm shift in web applications development, I love your work, people! I've been having some trouble trying to do something experimental, and was wondering if someone could offer me their insight or maybe a hint where I might be doing something wrong/bad...
I recently started looking at how to produce selection lists dynamically, and came across the code from FlowJXPathSelectionListBuilder. What I've been wanting to do is specify a new kind of selection list that calls a pipeline, optionally with parameters that may require evaluation of expressions against the form, e.g.:
...
<wd:selection-list type="pipeline" select="/countries" match="country" caption="@countryname" value="@id">
<wd:selection-list-param name="some-parameter" value="static-value"/>
<wd:selection-list-param name="continent" ref="/continent"/>
</wd:selection-list>
...
In this example, I wanted to resolve the value somehow from the form in the case of the parameter "continent". Ideally I do not want to have to pass this additionally in the business data since the form is already there. (I understand the form def is using widget ID's and it's not the same as the JXPath into object the form is bound to, but I will look soon into how I might generate the widgetID, given the path from the binding definition).
So, I implement SelectionList with a new class and I put it in the cocoon.xconf etc for the selection-list hint. What I'm having trouble with is getting at anything useful from this components' context. I couldn't determine if there was a better way to obtain a reference to the form, I followed some code that was in FlowJXPathSelectionListBuilder/FlowJXPathSelectionList but it appears to not work:
FlowJXPathSelectionListBuilder (implements SelectionListBuilder,Contextualizable) passes the context object it receives to a FlowJXPathSelectionList which it instantiates. When the list was not created by any other means but the builder, it seems in FlowJXPathSelectionList.generateSaxFragment() that this call will retrieve something useful:
Object flowData = FlowHelper.getContextObject(ContextHelper.getObjectModel(this.context));
This value is however, null. I also tried stuffing the value in a request attr before calling sendPage() from flow, but the attribute is not present in the request that I obtain from the context object using. (I used ContextHelper.getObjectModel() and ObjectModelHelper to do that)
I noticed in the woody samples, that something similar is done with the country selector demo, but a lot of selection list handling seems to be implemented in javascript in the form definition, and I'd like to avoid that if at all possible. What seems bizarre is that the XSP result page for this demo uses a similar mechanism to one I tried in the SelectionListBuilder/SelectionList, and it did not work.
So, um, I hate not being a very concise person, ... but, is what I'm trying to do wrong? or is the context not behaving as it should? or should I be implementing something else to obtain the form reference more easily?
Many thanks for any advice you may be able to offer, Sam
