You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Martin Koci <Ma...@aura.cz> on 2007/01/09 22:49:11 UTC

Buggy selectOrderShuttle with latest snapshot?

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 



Re: Buggy selectOrderShuttle with latest snapshot?

Posted by Adam Winer <aw...@gmail.com>.
Thanks so much - I've created:

https://issues.apache.org/jira/browse/ADFFACES-353

... and assigned it to me, so we keep track of this.

-- Adam


On 1/15/07, Martin Koci <Ma...@aura.cz> wrote:
> 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 <Ma...@aura.cz> 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
> > >
> > >
> > >
> >
>
>

Re: Buggy selectOrderShuttle with latest snapshot?

Posted by Martin Koci <Ma...@aura.cz>.
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 <Ma...@aura.cz> 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
> >
> >
> >
> 


Re: Buggy selectOrderShuttle with latest snapshot?

Posted by Adam Winer <aw...@gmail.com>.
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 <Ma...@aura.cz> 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
>
>
>