bug: contiguous itemsets are treated as nested when itemset is refreshed

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

bug: contiguous itemsets are treated as nested when itemset is refreshed

Adrian Baker
Lets say I have a <xf:select1> with multiple adjacent itemsets, eg

    <xf:select1>
        <xf:itemset bind="bind-types">
            <xf:label ref="@value"/>
            <xf:value ref="@value"/>
        </xf:itemset>
        <xf:itemset bind="bind-types2">
            <xf:label ref="@value"/>
            <xf:value ref="@value"/>
        </xf:itemset>
    </xf:select1>

The intial HTML is correctly generated with a single combined set of options from each itemset. If however the itemsets change and the option are rebuilt, the second itemset is incorrectly being treated as a nested itemset, and generated as a sub-option group of the first. Also the last option of the first itemset isn't available as an option, instead just as the label as the nested option group.

Attached is an example showing the problem: initially the options are correct. If you uncheck then recheck the boolean flag, the rebuilt dropdown is incorrect.

It looks like org.orbeon.oxf.xforms.control.controls.XFormsSelect1Control is not decrementing hierarchyLevel in the endElement() method (for both choices & itemsets). Intially I thought that a simple implementation of

            public void endElement(Element element) {
               
                 if ("itemset".equals(element.getName()) || "choices".equals(element.getName())) {
                     hierarchyLevel--;
                 }
            }

might work, but this is too simplistic because 
hierarchyLevel is not always incremented in startElement, and it's not clear that it's always incremented by just one.

It's a pity the (correct) logic in XFormsSelect1Handler which does the initial generatation isn't being shared here, to reduce the duplication of some fairly tricky code.

Adrian


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

incorrect-itemset-processing.xhtml (95K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: bug: contiguous itemsets are treated as nested when itemset is refreshed

Alessandro Vernet
Administrator
Adrian,

On 10/16/07, Adrian Baker <[hidden email]> wrote:
> The intial HTML is correctly generated with a single combined set of
> options from each itemset. If however the itemsets change and the option are
> rebuilt, the second itemset is incorrectly being treated as a nested
> itemset, and generated as a sub-option group of the first. Also the last
> option of the first itemset isn't available as an option, instead just as
> the label as the nested option group.

I can see the problem, and have entered this bug for tracking:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=307701&group_id=168&atid=350207

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: bug: contiguous itemsets are treated as nested when itemset is refreshed

Erik Bruchez
Administrator
In reply to this post by Adrian Baker
Adrian,

This issue should now be fixed, along with other related problems. We
refactored the code quite a bit into a class called XFormsItemUtils and
removed the code duplication. Some of this remains tricky, but hopefully
this is a step in the right direction :-)

-Erik

Adrian Baker wrote:

> Lets say I have a <xf:select1> with multiple adjacent itemsets, eg
>
>     <xf:select1>
>         <xf:itemset bind="bind-types">
>             <xf:label ref="@value"/>
>             <xf:value ref="@value"/>
>         </xf:itemset>
>         <xf:itemset bind="bind-types2">
>             <xf:label ref="@value"/>
>             <xf:value ref="@value"/>
>         </xf:itemset>
>     </xf:select1>
>
> The intial HTML is correctly generated with a single combined set of
> options from each itemset. If however the itemsets change and the option
> are rebuilt, the second itemset is incorrectly being treated as a nested
> itemset, and generated as a sub-option group of the first. Also the last
> option of the first itemset isn't available as an option, instead just
> as the label as the nested option group.
>
> Attached is an example showing the problem: initially the options are
> correct. If you uncheck then recheck the boolean flag, the rebuilt
> dropdown is incorrect.
>
> It looks like
> org.orbeon.oxf.xforms.control.controls.XFormsSelect1Control is not
> decrementing hierarchyLevel in the endElement() method (for both choices
> & itemsets). Intially I thought that a simple implementation of
>
>             public void endElement(Element element) {
>                
>                  if ("itemset".equals(element.getName()) ||
> "choices".equals(element.getName())) {
>                      hierarchyLevel--;
>                  }
>             }
>
> might work, but this is too simplistic because  hierarchyLevel is not
> always incremented in startElement, and it's not clear that it's always
> incremented by just one.
>
> It's a pity the (correct) logic in XFormsSelect1Handler which does the
> initial generatation isn't being shared here, to reduce the duplication
> of some fairly tricky code.
>
> Adrian
>

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws