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 26 public class RowActionDefinition extends ActionDefinition { 27 28 public Widget createInstance() { 29 return new RowAction(this); 30 } 31 32 public static class DeleteRowDefinition extends RowActionDefinition { 33 public DeleteRowDefinition() { 34 super.addActionListener(new ActionListener() { 35 36 public void actionPerformed(ActionEvent event) { 37 Repeater.RepeaterRow row = Repeater.getParentRow(event.getSourceWidget()); 38 Repeater repeater = (Repeater)row.getParent(); 39 repeater.removeRow(repeater.indexOf(row)); 40 } 41 }); 42 } 43 } 44 45 public static class MoveUpDefinition extends RowActionDefinition { 46 public MoveUpDefinition() { 47 super.addActionListener(new ActionListener() { 48 49 public void actionPerformed(ActionEvent event) { 50 Repeater.RepeaterRow row = Repeater.getParentRow(event.getSourceWidget()); 51 Repeater repeater = (Repeater)row.getParent(); 52 repeater.moveRowLeft(repeater.indexOf(row)); 54 } 55 }); 56 } 57 } 58 59 public static class MoveDownDefinition extends RowActionDefinition { 60 public MoveDownDefinition() { 61 super.addActionListener(new ActionListener() { 62 63 public void actionPerformed(ActionEvent event) { 64 Repeater.RepeaterRow row = Repeater.getParentRow(event.getSourceWidget()); 65 Repeater repeater = (Repeater)row.getParent(); 66 repeater.moveRowRight(repeater.indexOf(row)); 68 } 69 }); 70 } 71 } 72 73 public static class AddAfterDefinition extends RowActionDefinition { 74 public AddAfterDefinition() { 75 super.addActionListener(new ActionListener() { 76 77 public void actionPerformed(ActionEvent event) { 78 Repeater.RepeaterRow row = Repeater.getParentRow(event.getSourceWidget()); 79 Repeater repeater = (Repeater)row.getParent(); 80 repeater.addRow(repeater.indexOf(row)+1); 81 } 82 }); 83 } 84 } 85 86 87 } 88 | Popular Tags |