W3C home > Mailing lists > Public > www-forms@w3.org > July 2006

Re: Need for a 'global instance' function [was Re: i18n, componentized forms and multiple models]

From: Erik Bruchez <ebruchez@orbeon.com>
Date: Wed, 26 Jul 2006 16:42:28 +0200
Message-ID: <44C77F54.6040903@orbeon.com>
To: www-forms@w3.org


A question related to your use of models to provide modular components: 
do you have a mechanism by which you can call a method on the model 
(send an event) and pass it an instance? For example, if your model 
implements a "save" function into eXist, ideally you would try to 
achieve something like this (using an OO notation):


Now I see how you dispatch a "save" event to the model with id 
"my-model", but how do you pass it data? Do you use event context 


Mark Birbeck wrote:
> Hi Erik,
>> But wouldn't allowing this function to be called from a model encourage
>> breaking encapsulation? Wouldn't events be enough as a mechanism to
>> communicate between models?
>> For use within controls I don't disagree though. Maybe the instance()
>> function could simply take an optional second parameter, that would
>> indicate if the search for instances should be global:
>> [...]
> We felt that having a different function made it clearer that we were
> really doing a lookup, rather than establishing a connection between
> the models. The point here is that we actually *don't* want a
> 'connection' between the models, since this 'leak' would then require
> longer rebuilds. But we *do* want to be able to reference data in
> other models, such as when using an instance as a source of templates
> for xf:insert.
> There are actually many situations in XForms where you use a value in
> a calculation on a 'per-use' basis, such as in xf:setvalue or
> xf:insert, and since this creates no dependency, it's not going to
> hurt to be able to get data from other models for these actions.
> As it happens, in most of our stuff we don't have expressions that mix
> models within one XPath statement; what we try to do is use our
> encapsulation techniques, and just copy out the data we need with
> setvalue or insert. So far we've kept our use of globalInstance() to
> that, and it has worked pretty well.
> Regards,
> Mark

Orbeon - XForms Everywhere:
Received on Wednesday, 26 July 2006 14:42:36 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:18 UTC