incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Winer" <awi...@gmail.com>
Subject Re: selectManyListbox issue
Date Wed, 07 Mar 2007 17:13:42 GMT
I'd need to look at the code, but if I remember correctly, the
selectedIndices array is supposed to be sorted before here.
I've got a bad feeling that the sorting was removed in at
least one code path at some point in the recent past,
while fixing some shuttle bugs.

-- Adam

On 3/5/07, Steve Vangasse <steve@boardshop.co.uk> wrote:
> I've looked a little further into this and it looks like it might be a
> bug in Trinidad. In SimpleSelectManyRenderer getSelectedIndices() method
> an int array called indices is used to define the index of each value in
> the selection list. The code works fine when the selection list and the
> value list are in the same order, but when they are different it breaks
> down.
>
> The indices array is passed to SimpleSelectManyListboxRenderer
> encodeElementContent() method where assignment of the boolean selected
> variable relies on the values in the array being in numerical order:
>
>
>
>     int selectedCount = selectedIndices.length;
>     int selectedEntry = 0;
>     for (int i = 0; i < count; i++)
>     {
>       boolean selected = ((selectedEntry < selectedCount) &&
>                           (i == selectedIndices[selectedEntry]));
>       if (selected)
>         selectedEntry++;
>
>       SelectItem item = selectItems.get(i);
>       SimpleSelectOneRenderer.encodeOption(
>            context, arc, component, item, converter,
>            valuePassThru, i, selected);
>     }
>
>
>
> When the selection list and the value list have different ordering the
> values in the indices array are not in numerical order. The code then
> misses selected elements and they are not rendered as selected. Is this
> a bug?
>
> Thanks,
>
> Steve Vangasse
>
>
>
> -----Original Message-----
> From: Steve Vangasse [mailto:steve@boardshop.co.uk]
> Sent: 16 February 2007 17:19
> To: adffaces-user@incubator.apache.org
> Subject: tr:selectManyListbox issue
>
> Is anyone else having issues with tr:selectManyListbox on the current
> trinidad snapshot. It only renders one option as selected on a list
> where there a multiple selections. Submitting the form with multiple
> selections updates the model correctly but then renders just the one as
> selected.
>
>     <tr:selectManyListbox label="#{msgs.deliveryZones}"
> value="#{salesOrders$delivery$optionForm.crudObject.zones}"
> required="true">
>      <f:selectItems
> value="#{salesOrders$delivery$deliveryUtils.zones}"/>
>     </tr:selectManyListbox>
>
> salesOrders$delivery$optionForm.crudObject.zones is a List of objects
> and salesOrders$delivery$deliveryUtils.zones is a List of SelectItems
> whose vales are the complete set of those objects.
>
> Any ideas?
>
> Thanks,
>
> Steve Vangasse
>
>

Mime
View raw message