Guest User

ModelForForm

a guest
Oct 20th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. import java.io.Serializable;
  2. import java.util.LinkedList;
  3. import java.util.List;
  4.  
  5. public class ModelForForm implements Serializable {
  6.  
  7. private static final long serialVersionUID = -6051225004495642982L;
  8.  
  9. private Boolean checkAll;
  10. private String txtName;
  11. private List<Wrapper> list = new LinkedList<>();
  12.  
  13. public ModelForForm() {
  14.  
  15. }
  16.  
  17. public void setListTestBean(List<TestBean> listTestBean) {
  18. for (TestBean testBean : listTestBean) {
  19. list.add(new Wrapper(testBean));
  20. }
  21. }
  22.  
  23. public int size() {
  24. int n = 0;
  25. for (Wrapper wrapper : list) {
  26. n += wrapper.getChecked() ? 1 : 0;
  27. }
  28. return n;
  29. }
  30.  
  31. public void serCheckAll(boolean value) {
  32. for (Wrapper wrapper : list) {
  33. wrapper.setChecked(value);
  34. }
  35. }
  36.  
  37. public boolean allItemChecked() {
  38. return size() == list.size();
  39. }
  40.  
  41. public Boolean getCheckAll() {
  42. return checkAll;
  43. }
  44.  
  45. public void setCheckAll(Boolean checkAll) {
  46. this.checkAll = checkAll;
  47. }
  48.  
  49. public List<Wrapper> getList() {
  50. return list;
  51. }
  52.  
  53. public String getTxtName() {
  54. return txtName;
  55. }
  56.  
  57. public void setTxtName(String txtName) {
  58. this.txtName = txtName;
  59. }
  60. }
Add Comment
Please, Sign In to add comment