1 16 package org.apache.cocoon.woody.formmodel; 17 18 import org.apache.cocoon.woody.event.ActionEvent; 19 import org.apache.cocoon.woody.event.ActionListener; 20 21 27 public class DeleteRowsActionDefinition extends RepeaterActionDefinition { 28 29 private String selectName; 30 31 public DeleteRowsActionDefinition(String repeaterName, String selectName) { 32 super(repeaterName); 33 this.selectName = selectName; 34 35 this.addActionListener(new ActionListener() { 36 public void actionPerformed(ActionEvent event) { 37 Repeater repeater = ((RepeaterAction)event.getSource()).getRepeater(); 38 for (int i = repeater.getSize() - 1; i >= 0; i--) { 39 Repeater.RepeaterRow row = repeater.getRow(i); 40 if (Boolean.TRUE.equals(row.getWidget(DeleteRowsActionDefinition.this.selectName).getValue())) { 41 repeater.removeRow(i); 42 } 43 } 44 } 45 }); 46 } 47 } 48 | Popular Tags |