OLD | NEW |
(Empty) | |
| 1 package autotest.afe; |
| 2 |
| 3 import java.util.ArrayList; |
| 4 import java.util.List; |
| 5 |
| 6 public class CheckBoxPanel { |
| 7 public static interface Display { |
| 8 public ICheckBox generateCheckBox(int index); |
| 9 } |
| 10 |
| 11 private List<ICheckBox> checkBoxes = new ArrayList<ICheckBox>(); |
| 12 private Display display; |
| 13 |
| 14 public void bindDisplay(Display display) { |
| 15 this.display = display; |
| 16 } |
| 17 |
| 18 public ICheckBox generateCheckBox() { |
| 19 return display.generateCheckBox(checkBoxes.size()); |
| 20 } |
| 21 |
| 22 public void add(ICheckBox checkBox) { |
| 23 checkBoxes.add(checkBox); |
| 24 } |
| 25 |
| 26 public List<ICheckBox> getChecked() { |
| 27 List<ICheckBox> result = new ArrayList<ICheckBox>(); |
| 28 for(ICheckBox checkBox : checkBoxes) { |
| 29 if (checkBox.getValue()) { |
| 30 result.add(checkBox); |
| 31 } |
| 32 } |
| 33 return result; |
| 34 } |
| 35 |
| 36 public void setEnabled(boolean enabled) { |
| 37 for(ICheckBox thisBox : checkBoxes) { |
| 38 thisBox.setEnabled(enabled); |
| 39 } |
| 40 } |
| 41 |
| 42 public void reset() { |
| 43 for (ICheckBox thisBox : checkBoxes) { |
| 44 thisBox.setValue(false); |
| 45 } |
| 46 } |
| 47 } |
OLD | NEW |