Hello,
probably there are two problems:
1) SimpleSelectManyRenderer.getSelectedIndices does not respect order
of selected items.
I think:
indices[lastEntry] = i;
lastEntry++;
should be:
indices[index] = i;
and some other modifications
2) Then we should modify SelectManyShuttleRenderer.encodeElementContent
from:
for (int i = selectedIndices.length - 1; i >=0; i--)
{
trailingSelectItems.add(0,
leadingSelectItems.remove(selectedIndices[i]));
}
to:
for (int i = 0; i < selectedIndices.length; i++)
{
int j = selectedIndices[i];
trailingSelectItems.add(selectItems.get(j));
}
for (int i = 0; i < selectedIndices.length; i++)
{
int j = selectedIndices[i];
leadingSelectItems.remove(j);
}
Can you review that code? This patch is working for me, but can break
something else.
Thanks,
Martin
Adam Winer píše v Út 09. 01. 2007 v 16:16 -0800:
> The new code is in:
>
> trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SelectManyShuttleRenderer.java
> and SelectOrderShuttleRenderer.java.
>
> -- Adam
>
>
> On 1/9/07, Martin Koci <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I've upgraded for a two month old build of trinidad to latest from SVN,
> > but selectOrderShuttle doesnt work correctly.
> >
> > Bug can be reproduced with trinidad-demo.war. Go to to
> > selectOrderShuttle component demo and select value "Third" as first and
> > value "Second" as second.
> > After sumbit is "Third" moved to second position and "Second" to first -
> > simply component doesn't hold order ...
> >
> > Problem is in render response phase, because submitted values are ok,
> > update model phase sets right values, but component display values in
> > unexpected order.
> >
> > Can anybody point me to right place in code? I think this bug was
> > introduced with rewriting from UIX renderer to xhtml render kit.
> >
> >
> > Thanks,
> >
> > Martin
> >
> >
> >
>