1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.uruma.binding.enables.impl;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.seasar.uruma.annotation.EventListener;
22 import org.seasar.uruma.annotation.ExportValue;
23 import org.seasar.uruma.annotation.Form;
24 import org.seasar.uruma.annotation.InitializeMethod;
25 import org.seasar.uruma.renderer.impl.AbstractGUITest;
26
27
28
29
30
31
32 public class ViewerEnablesDependingListenerGUITest extends AbstractGUITest {
33
34 private int nextIndex = 0;
35
36 @ExportValue(id = "table")
37 public List<TableBean> tableBeans;
38
39 @InitializeMethod
40 public void initialize() {
41 tableBeans = new ArrayList<TableBean>();
42 for (int i = 0; i < 10; i++) {
43 addItem();
44 }
45 }
46
47 @EventListener(id = "addItemButton")
48 public void addItem() {
49 TableBean bean = new TableBean();
50 bean.setColumn1("data" + nextIndex);
51 bean.setColumn2(String.valueOf(nextIndex));
52 tableBeans.add(bean);
53 nextIndex++;
54 }
55
56 @EventListener(id = "removeAllButton")
57 public void removeAll() {
58 tableBeans.clear();
59 }
60
61 @EventListener(id = "nullButton")
62 public void nullOperation() {
63 }
64
65 public static class TableBean {
66 private String column1;
67
68 private String column2;
69
70 public String getColumn1() {
71 return this.column1;
72 }
73
74 public void setColumn1(final String column1) {
75 this.column1 = column1;
76 }
77
78 public String getColumn2() {
79 return this.column2;
80 }
81
82 public void setColumn2(final String column2) {
83 this.column2 = column2;
84 }
85 }
86 }