1   /*
2    * Copyright 2004-2008 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
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   * {@link ViewerEnablesDependingListener} のためのテストクラスです。<br />
29   * 
30   * @author bskuroneko
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  }