cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
Subject Re: [VOTE] Add parameter to Woody {SelectionList,Widget}.generateSaxFragment
Date Tue, 21 Oct 2003 10:46:40 GMT
Sylvain Wallez wrote:
> Can you explain in more details what's the purpose of the jxpathContext 
> here and where its value come from? Adding a dependency on JXPath so 
> high in Woody interfaces doesn't seem good to me.

The value comes from WoodyTemplateTransformer:

         Object flowContext = FlowHelper.getContextObject(objectModel);
         WebContinuation wk = FlowHelper.getWebContinuation(objectModel);
         JXPathContext jxpc = JXPathContext.newContext(flowContext);

(similar code must be added to WoodyGenerator also).

We need this if we want to populate selection lists with collections 
defined in the flowscript and avoid the need to call a different 
pipeline. Please have a look at the following (contrived) sample, while 
I try to prepare a more meaningful one:

<wd:selection-list model="model" key="key" value="value"/>

...

public class MyBean {
   public int getKey() { ... }
   public String getValue() { ... }
};

...

var list = [ new MyBean(1, 'One'), new MyBean(2, 'Two') ];
form.showForm("uri", { "model" : list });


Now that I think about it, we might as well pass "Object flowContext" to 
generateSaxFragment, thus avoiding a dependency on JXPath. So, I'm 
changing my proposal to the following:

Change the signature of two interface methods:

org.apache.cocoon.woody.formmodel.Widget.generateSaxFragment
org.apache.cocoon.woody.datatype.SelectionList.generateSaxFragment

by adding a third parameter:

void generateSaxFragment(ContentHandler contentHandler, Locale locale, 
Object flowContext)

Hope this answers your doubts.

	Ugo

-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it


Mime
View raw message