You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by badluck13 <bl...@gmail.com> on 2010/08/23 12:32:09 UTC
[T5.1] Loop and position of elements
Hello dear list,
I have little issue here, I have a collection that I fill with values using
action links, its empty in begging and I'm adding objects afterwards...
@Persist
private List l = new ArrayList();
onActionFromAdd(Object o){
l.add(o);
}
and with help of zone I redisplay loop...
Now, after 3-4 object loop start to shuffle objects inside it... so insted
object 1
object 2
object 3
object 4
I get:
object 3
object 1
object 2
object 4
and so on, it shuffle elements with every new addition, I tried to use the
Grid but same thing there...
Now is there a way to stop this behavior, because every one expects that
position of thing they enter stay same, and not to shuffle on every
addition...
And if anyone have other suggestion how to loop try collection and preserve
initial order of thing that would be very helpful.
Thanks in advance
Bojan
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-1-Loop-and-position-of-elements-tp2644473p2644473.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5.1] Loop and position of elements
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 23 Aug 2010 10:47:20 -0300, badluck13 <bl...@gmail.com> wrote:
> Sorry I mislead you, I already do that onActivate() method...
Even if you initialize your field in onActivate(), you shouldn't
initialize it in its declaration unless the value is immutable (String,
primitive types, etc).
> Any other possible solutions? :(
Loop and Grid iterate the elements in exactly the same order as they are
presented by the collection you passed to them, so I guess the problem is
somewhere else.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5.1] Loop and position of elements
Posted by badluck13 <bl...@gmail.com>.
Sorry I mislead you, I already do that onActivate() method...
Any other possible solutions? :(
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-1-Loop-and-position-of-elements-tp2644473p2644669.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5.1] Loop and position of elements
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 23 Aug 2010 07:32:09 -0300, badluck13 <bl...@gmail.com> wrote:
> Hello dear list,
Hi!
> I have little issue here, I have a collection that I fill with values
> using action links, its empty in begging and I'm adding objects
> afterwards...
>
> @Persist
> private List l = new ArrayList();
Never initialize a field with a mutable value, because all users of your
application will use the same instance of ArrayList. Use onActivate() or
@BeginRender for that.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org