Never mind!  The problem had nothing to do with Wicket.  My error was trying to delete elements of the very list I was iterating:

    for (CheckboxData cbd : listToBePruned ){

      if ( !cbd.isChecked() ) {

        listToBePruned.remove(cbd);

      }

    }

 

A different looping strategy solved it.  /Frank

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Frank Silbermann
Sent:
Tuesday, May 09, 2006 12:35 PM
To: [email protected]
Subject: [Wicket-user] Concurrent Modification Exception

 

I created a CheckboxData type containing a boolean (checked) and a label.

 

I created a CheckboxDataPanel whose constructor takes a CheckboxData object, and which displays a checkbox and the label – each using a PropertyModel built from the Checkbox Data object.

 

I constructed a ListView using a List<CheckboxData>, which displays a CheckboxDataPanel for each item.

 

I have a button which removes from the List<CheckboxData> every CheckboxData object whose check field is unchecked.  When I click this button, I would expect the ListView would shrink – perhaps down to nothing if none were checked.  When I press it to remove the last remaining item, however, I get a java.util.ConcurrentModificationException.
 
What am I doing wrong?  I’ve been using an ArrayList as my List implementation, but I get the same result using a Vector.  Could I avoid this problem by using a CheckboxGroup instead of my own ListView?  

 

Reply via email to