You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ma...@sqs.de on 2005/06/09 12:26:27 UTC

Remove Objects from a List

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

i'm a little bit confused. I have a List with some Objects, depended on what
the user chose. The User can add more Objects to this List with a
PropertySelection and a button. That works fine.

<property-specification name="chosenProjects1" type="java.util.List"
persistent="yes"/>
(getter and setter are abstract)

<component id="addProj1" type="Submit">
	<binding name="listener" expression="listeners.addProj1"/>
	<static-binding name="label" value="Hinzufuegen"/>
</component>

I'd like to delete also some Objects from the List with a button. The
application can delete the object from the List, but if it's not the last
object in the List, i get an java.util.ConcurrentModificationException.

<component id="eachProjects1" type="Foreach">
	<binding name="source" expression="chosenProjects1"/>
	<binding name="value" expression="projectAccess"/>
	<static-binding name="element" value="div"/>
</component>

<component id="delProj1" type="Submit">
	<binding name="listener" expression="listeners.delProj1"/>
	<binding name="tag" expression="projectAccess"/>
	<binding name="selected" expression="delProject1"/>
	<static-binding name="label" value="Entfernen"/>
</component>

Does anyone can help me with that problem?

Best Regards,

Mathias

- --
Mathias Herkt (Diplomand)    | SQS Software Quality Systems AG
                             | Stollwerckstrasse 11
Phone:+49 2203/9154-7110     | D-51149 Cologne, GERMANY
Fax:+49 2203/9154-15         | http://www.sqs.de

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFCqBlT8hWAS3IShqURAiM8AJ4zn4hbpLzfHg1uRs5qpJWoybfhZACfSd+s
M4Qcn8HFKXop3UTjgxfoc2o=
=5P/p
-----END PGP SIGNATURE-----

Re: Remove Objects from a List

Posted by Jean Tremblay <je...@gmail.com>.
Hi,

This error would occur with normal collections if you try to remove
items while iterating over it.

You must use the iterator.remove(). 
http://java.sun.com/j2se/1.5.0/docs/api/java/util/ConcurrentModificationException.html

Hope this can be of use.

On 6/9/05, Robert Zeigler <ro...@scazdl.org> wrote:
> I'm not sure what you're trying to accomplish, but...
> it you might try looking at the palette component (in the contrib
> library). You give a list of available options (through a property
> selection model), and the user can add or remove "selected" options to a
> list...
> 
> Robert
> 
> Mathias.Herkt@sqs.de wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Hi,
> >
> > i'm a little bit confused. I have a List with some Objects, depended on what
> > the user chose. The User can add more Objects to this List with a
> > PropertySelection and a button. That works fine.
> >
> > <property-specification name="chosenProjects1" type="java.util.List"
> > persistent="yes"/>
> > (getter and setter are abstract)
> >
> > <component id="addProj1" type="Submit">
> >       <binding name="listener" expression="listeners.addProj1"/>
> >       <static-binding name="label" value="Hinzufuegen"/>
> > </component>
> >
> > I'd like to delete also some Objects from the List with a button. The
> > application can delete the object from the List, but if it's not the last
> > object in the List, i get an java.util.ConcurrentModificationException.
> >
> > <component id="eachProjects1" type="Foreach">
> >       <binding name="source" expression="chosenProjects1"/>
> >       <binding name="value" expression="projectAccess"/>
> >       <static-binding name="element" value="div"/>
> > </component>
> >
> > <component id="delProj1" type="Submit">
> >       <binding name="listener" expression="listeners.delProj1"/>
> >       <binding name="tag" expression="projectAccess"/>
> >       <binding name="selected" expression="delProject1"/>
> >       <static-binding name="label" value="Entfernen"/>
> > </component>
> >
> > Does anyone can help me with that problem?
> >
> > Best Regards,
> >
> > Mathias
> >
> > - --
> > Mathias Herkt (Diplomand)    | SQS Software Quality Systems AG
> >                              | Stollwerckstrasse 11
> > Phone:+49 2203/9154-7110     | D-51149 Cologne, GERMANY
> > Fax:+49 2203/9154-15         | http://www.sqs.de
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.1 (MingW32)
> >
> > iD8DBQFCqBlT8hWAS3IShqURAiM8AJ4zn4hbpLzfHg1uRs5qpJWoybfhZACfSd+s
> > M4Qcn8HFKXop3UTjgxfoc2o=
> > =5P/p
> > -----END PGP SIGNATURE-----
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Remove Objects from a List

Posted by Robert Zeigler <ro...@scazdl.org>.
I'm not sure what you're trying to accomplish, but...
it you might try looking at the palette component (in the contrib
library). You give a list of available options (through a property
selection model), and the user can add or remove "selected" options to a
list...

Robert

Mathias.Herkt@sqs.de wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> i'm a little bit confused. I have a List with some Objects, depended on what
> the user chose. The User can add more Objects to this List with a
> PropertySelection and a button. That works fine.
> 
> <property-specification name="chosenProjects1" type="java.util.List"
> persistent="yes"/>
> (getter and setter are abstract)
> 
> <component id="addProj1" type="Submit">
> 	<binding name="listener" expression="listeners.addProj1"/>
> 	<static-binding name="label" value="Hinzufuegen"/>
> </component>
> 
> I'd like to delete also some Objects from the List with a button. The
> application can delete the object from the List, but if it's not the last
> object in the List, i get an java.util.ConcurrentModificationException.
> 
> <component id="eachProjects1" type="Foreach">
> 	<binding name="source" expression="chosenProjects1"/>
> 	<binding name="value" expression="projectAccess"/>
> 	<static-binding name="element" value="div"/>
> </component>
> 
> <component id="delProj1" type="Submit">
> 	<binding name="listener" expression="listeners.delProj1"/>
> 	<binding name="tag" expression="projectAccess"/>
> 	<binding name="selected" expression="delProject1"/>
> 	<static-binding name="label" value="Entfernen"/>
> </component>
> 
> Does anyone can help me with that problem?
> 
> Best Regards,
> 
> Mathias
> 
> - --
> Mathias Herkt (Diplomand)    | SQS Software Quality Systems AG
>                              | Stollwerckstrasse 11
> Phone:+49 2203/9154-7110     | D-51149 Cologne, GERMANY
> Fax:+49 2203/9154-15         | http://www.sqs.de
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (MingW32)
> 
> iD8DBQFCqBlT8hWAS3IShqURAiM8AJ4zn4hbpLzfHg1uRs5qpJWoybfhZACfSd+s
> M4Qcn8HFKXop3UTjgxfoc2o=
> =5P/p
> -----END PGP SIGNATURE-----
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org