1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.view.facelets.tag.composite;
20
21 import javax.faces.component.UIComponent;
22 import javax.faces.context.FacesContext;
23 import javax.faces.event.AbortProcessingException;
24 import javax.faces.event.ActionEvent;
25 import javax.faces.event.ActionListener;
26 import javax.faces.event.ValueChangeEvent;
27 import javax.faces.validator.ValidatorException;
28
29 public class MockAttributeBean
30 {
31
32 public String getStyle()
33 {
34 return "style1";
35 }
36
37 public String getStyleClass()
38 {
39 return "styleclass1";
40 }
41
42 public String getJavaProperty()
43 {
44 return "javaproperty1";
45 }
46
47 public String doSomethingFunny(String a)
48 {
49 return "somethingFunny"+a;
50 }
51
52 public String doSomeAction()
53 {
54 return "someAction";
55 }
56
57 private boolean actionListener1Called = false;
58
59 public boolean isActionListener1Called()
60 {
61 return actionListener1Called;
62 }
63
64 public void setActionListener1Called(boolean value)
65 {
66 actionListener1Called = value;
67 }
68
69 public void doSomeActionListener1()
70 {
71 actionListener1Called = true;
72 }
73
74 private boolean actionListener2Called = false;
75
76 public boolean isActionListener2Called()
77 {
78 return actionListener2Called;
79 }
80
81 public void setActionListener2Called(boolean value)
82 {
83 actionListener2Called = value;
84 }
85
86 public void doSomeActionListener2(ActionEvent evt)
87 {
88 actionListener2Called = true;
89 }
90
91 private boolean valueChangeListener1Called = false;
92
93 public boolean isValueChangeListener1Called()
94 {
95 return valueChangeListener1Called;
96 }
97
98 public void setValueChangeListener1Called(boolean value)
99 {
100 valueChangeListener1Called = value;
101 }
102
103 public void doSomeValueChangeListener1() throws AbortProcessingException
104 {
105 valueChangeListener1Called = true;
106 }
107
108 private boolean valueChangeListener2Called = false;
109
110 public boolean isValueChangeListener2Called()
111 {
112 return valueChangeListener2Called;
113 }
114
115 public void setValueChangeListener2Called(boolean value)
116 {
117 valueChangeListener2Called = value;
118 }
119
120 public void doSomeValueChangeListener2(ValueChangeEvent evt) throws AbortProcessingException
121 {
122 valueChangeListener2Called = true;
123 }
124
125 private boolean validator1Called = false;
126
127 public boolean isValidator1Called()
128 {
129 return validator1Called;
130 }
131
132 public void setValidator1Called(boolean value)
133 {
134 validator1Called = value;
135 }
136
137 public void doSomeValidator1(FacesContext context, UIComponent component, Object value) throws ValidatorException
138 {
139 validator1Called = true;
140 }
141
142 private ActionListener submitActionListener;
143 private ActionListener cancelActionListener;
144
145 private boolean submitActionListenerCalled = false;
146 private boolean cancelActionListenerCalled = false;
147
148 public ActionListener getSubmitActionListener()
149 {
150 if (submitActionListener == null)
151 {
152 submitActionListener = new ActionListener(){
153
154 public void processAction(ActionEvent actionEvent)
155 throws AbortProcessingException
156 {
157
158
159 submitActionListenerCalled = true;
160 }
161 };
162 }
163 return submitActionListener;
164 }
165
166 public ActionListener getCancelActionListener()
167 {
168 if (cancelActionListener == null)
169 {
170 cancelActionListener = new ActionListener()
171 {
172
173 public void processAction(ActionEvent actionEvent)
174 throws AbortProcessingException
175 {
176
177
178 cancelActionListenerCalled = true;
179 }
180 };
181 }
182 return cancelActionListener;
183 }
184
185 public String cancelAction()
186 {
187 return "testActionMethodTypeCancel";
188 }
189
190 public boolean isSubmitActionListenerCalled()
191 {
192 return submitActionListenerCalled;
193 }
194
195 public boolean isCancelActionListenerCalled()
196 {
197 return cancelActionListenerCalled;
198 }
199
200 public void setSubmitActionListenerCalled(boolean submitActionListenerCalled)
201 {
202 this.submitActionListenerCalled = submitActionListenerCalled;
203 }
204
205 public void setCancelActionListenerCalled(boolean cancelActionListenerCalled)
206 {
207 this.cancelActionListenerCalled = cancelActionListenerCalled;
208 }
209
210 private String name;
211
212 public String getName()
213 {
214 return name;
215 }
216
217 public void setName(String name)
218 {
219 this.name = name;
220 }
221 }