logo       
Google Custom Search
    AddThis Social Bookmark Button

RE: Custom action in Chiba: msg#00108

Subject: RE: Custom action in Chiba
Hi,

>another way to trigger custom calculation and validation would be chiba
extension functions. i just made them work again >>in the current CVS
code ;-)
Thanks. :) Will this be made available in the 0.9.4 release?

Regards,
Chin Ann

-----Original Message-----
From: Ulrich Nicolas Lissé [mailto:u.n.l-hi6Y0CQ0nG0@xxxxxxxxxxxxxxxx] 
Sent: Wednesday, January 21, 2004 6:28 PM
To: joern turner
Cc: Chin Ann, Lee; 
chiba-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
Subject: Re: [Chiba-developer] Custom action in Chiba


joern turner wrote:

> Chin Ann, Lee wrote:
> 
>> Hi,
>>  
>> Currently i'm using chiba 0.9.3 to function as a XForms server in my
>> project.
>>  
>> As my project requires some custom set of actions to be preformed
>> during a form session,
>> I'm looking towards implementing some custom actions in chiba.
>> (i.e, some custom validations need to be performed before switching
to 
>> another case in xforms)
>>  
>> Looking thru the codes, I noticed that there is a statement in
>> default.xml (chiba config file) that states "Attention: no other 
>> namespace than XForms is supported by now. This can
>> be easily added when custom actions occurs." and there is no 
>> ActionFactory to be found. Does that means
>> chiba currently does not support custom actions or am i missing 
>> something?

hi,

another way to trigger custom calculation and validation would be chiba
extension functions. i just made them work again in the current CVS code
;-)

there are two functions - chiba:calculate and chiba:validate - which can
be used in XPath expressions, i.e. in bindings. the functions have one
parameter each, an arbitrary URI. chiba then tries to find a connector
(modelitem calculator/validator) based on the URI's scheme, quite
analogous to submission handlers and uri resolvers.

an example:

<xforms:bind nodeset="data"
calculate="chiba:calculate('chiba:foo://bar')"/>

this will make the specified nodeset have the customly calculated value.
given you have implemented a
org.chiba.xml.xforms.connector.ModelItemCalculator and registered it
with chiba via the config (see org/chiba/xml/xforms/config/default.xml),
the processor will instantiate the connector during xforms-recalculate
processing, query it's interface method and store the result in the
corresponding node.

the same holds for validation, except that a boolean value is computed,
e.g:

<xforms:bind nodeset="data"
constraint="chiba:validate('chiba:foo://bar')"/>

this makes the nodeset's validity dependent on your external validation.

regards, uli.

> 
> you're right. we've disabled this support while refactoring the Chiba
> object model but it's planned to re-integrate it.
> 
> i've attached the old ActionFactory (not sure if its the last) to give
> you an idea of how it worked. The ActionFactory was configured by the 
> config-file from where it reads its action-entries
> 
> <action name="dispatch"    
>     class="org.chiba.xml.xforms.action.DispatchAction"/>
> <action name="refresh"    
>     class="org.chiba.xml.xforms.action.RefreshAction"/>
> <action name="recalculate" c
>     class="org.chiba.xml.xforms.action.RecalculateAction" />
> 
> these will then be used to instanciate the action via reflection at
> runtime (see createAction())
> 
>>  
>> For now, I have modified DispatchAction to fire my custom actions and
>> it is working fine. Another
>> alternative is to create another XFormsElement which extends 
>> AbstractAction to fire my custom actions and
>> modifying XFormsElementFactory to create it when it encounters my 
>> custom tag. Is there a more
>> elegant approach for facilitating custom actions now?
> 
> good idea.
> 
> 
>>  
>> In addition, every time a request is sent during a form session the
>> WebAdapter will
>> dispatch a recalculate, revalidate and refresh event. Is this
behavior 
>> a specified requirement in XForms?
>> Will wanting my custom action is be processed without going thru 
>> recalculate, revalidate and refresh events be
>> breaking the XForms standard?
> 
> see 
> http://www.w3.org/TR/2003/REC-xforms-20031014/slice4.html#rpm-event-se
> quences
> 
> 
> actually the recalc,reval,refresh in ServletAdapter will likely be
> removed in the next release. it's not necessary any more as soon as
our 
> event sequencing implementation works correctly (which hopefully is 
> already the case but still needs tests)
> 
> for your own actions you've to decide if any of these events will be
> necessary in conjunction with the execution of it. - as a hint: if
your 
> action modifies instance data (like insert, delete and setvalue do)
you 
> have to think about recalc, reval and sometimes even a rebuild (for 
> structural modifications) to ensure the model will still be consistent

> after your action. if your action is UI oriented like setfocus or
toggle 
> then a refresh might be needed if you change the display of some data.
> 
> hope this gives you some hints.
> 
> btw, i've put the re-integration on our tasklist at sourceforge.
> 
> Joern
> 
>>  
>> Please advise. Thanks.
>>  
>> Regards,
>> Chin Ann

-- 
Ulrich Nicolas Lissé






-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>