Re: When the view has refreshed, how would I know?

Actually, I think Philip is not asking a question that is ideally answered 
by databound switches, but rather is asking a question about maintaining 
switch cases across an instance replacement.  I agree with you, Erik, that 
switches should not resort back to their starting default cases because of 
something like an instance replacement.   It's a bug in the implementation 
to have the switch use the default case at any time other than 
initialization of the UI control. 

UI initialization is most easily seen to occur on form startup (i.e. 
during default processing of xforms-model-construct-done) and during 
creation of a new repeat item.  Generally, a UI control is capable of 
outliving the data to which it is bound, so even if an instance 
replacement occurs, if the switch was bound to a node and is again bound 
to a node, then the case selection would not be expected to change, even 
though the data inside the new node may be different and therefore the UI 
controls inside the case may bind to different nodes or have different 
values, or even not bind anymore.

The lifecycle of UI controls that directly become unbound or which become 
non-relevant for any of a host of reasons is a little hazier and was the 
subject of much discussion at the last face to face meeting. 

Cheers,
John M. Boyer, Ph.D.
STSM, Lotus Forms
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com 

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
Blog RSS feed: 
http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw





From:
Erik Bruchez <ebruchez@orbeon.com>
To:
"www-forms@w3.org" <www-forms@w3.org>
Date:
04/20/2010 03:38 PM
Subject:
Re: When the view has refreshed, how would I know?



Philip,

At least in Orbeon, switches will keep the currently selected case
until they become non-relevant (if they do become non-relevant). I
assume you have such a situation then? Otherwise, it's a bug ;)

Also, I assume you have looked at <fr:databound-switch>? [1]

Now one of the new features under consideration for XForms 1.2 is a
data-bound switch, which I think is meant to address exactly your use
case. [2] Note that this is just a proposal under consideration.
Feedback is welcome.

-Erik

[1] 
http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/databound-switch

[2] http://www.w3.org/MarkUp/Forms/wiki/Model-based_switching_with_switch

On Tue, Apr 20, 2010 at 2:05 AM, Philip Fennell
<Philip.Fennell@marklogic.com> wrote:
> I have a view, rendered by some XForms groups and controls and 
periodically
> the instance, from which the view is rendered, will get reloaded as a 
result
> of other events in the UI. This causes the view to refresh and as a 
result
> any switches in the view will revert to their default case.
>
> Now, I can maintain the current selection(s) in an additional instance 
data
> structure but it doesn't appear that there is an event I can listener 
for
> that is dispatched once the view has completed rendering. If there was 
then
> I could invoke a toggle action to set the appropriate case(s). This, of
> course, relies upon the case element variant of a toggle action but just
> having an 'xforms-refresh-done' event would be nice.
>
> I see in Orbeon's documentation that they have considered this scenario, 
but
> I wonder what other people have experienced in this area.
>
>
> Regards
>
> Philip Fennell
>
> Consultant
>
> Mark Logic Corporation

Received on Wednesday, 21 April 2010 00:47:44 UTC