In table check box is not setting value


In table i am adding checkboxs, at the same time setting data on checkbox,however the last checkbox data is only set on all the checkboxes in table whenever i check on any checkbox.

private void ensureSequence(List<Sequence> formfield) {

    for (int i = 1; i <= formfield.size(); i++) {
        String objname = "";
        Sequence addsequence = (Sequence) formfield.get(i - 1);

        Sequence addSequence = new Sequence();
        addSequence.formField = addsequence.formField;
        addSequence.sequence = i;
        addSequence.isduplicate = addsequence.isduplicate;
        FormField objt = (FormField) addSequence.formField;
        objname =;
        table.setItemCaption(addSequence, objname);
        Container tableContainer = table.getContainerDataSource();
        tableContainer.getContainerProperty(addSequence, NAME).setValue(
        duplicity = new CheckBox();
        duplicity.addValueChangeListener(new ValueChangeListener() {

            public void valueChange(ValueChangeEvent event) {
                // TODO Auto-generated method stub
                Sequence seq = (Sequence) duplicity.getData();
                seq.isduplicate = (Boolean) event.getProperty().getValue();


        tableContainer.getContainerProperty(addSequence, DUPLICITY)


please help me to solve this problem

I’m not quite sure what you are after, but the line
duplicity = new CheckBox();
suggests that you store a reference to a checkbox in your class. You override the reference in each loop, so in the end you only have a reference to the last one. In your Listener you take the data from ‘duplicity’ but the value from whatever checkbox that was clicked; this is probably not what you want.

If you don’t need a reference to ‘duplicity’ anywhere else, you can fix it with this:
final CheckBox duplicity = new CheckBox();

or, you can do this in the listener:
Sequence seq = ((CheckBox) event.getProperty()).getData();

Thank you for reply…