01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.wicket.util.tester;
18:
19: import java.util.ArrayList;
20: import java.util.List;
21:
22: import org.apache.wicket.ajax.AjaxRequestTarget;
23: import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
24: import org.apache.wicket.markup.html.WebPage;
25: import org.apache.wicket.markup.html.form.Check;
26: import org.apache.wicket.markup.html.form.CheckGroup;
27: import org.apache.wicket.markup.html.form.Form;
28: import org.apache.wicket.model.Model;
29: import org.apache.wicket.model.PropertyModel;
30:
31: /**
32: * Mock page with form and checkgroup.
33: *
34: * @author Frank Bille (billen)
35: */
36: public class MockPageWithFormAndCheckGroup extends WebPage {
37: private static final long serialVersionUID = 1L;
38:
39: private List selected = new ArrayList();
40:
41: /**
42: * Construct.
43: */
44: public MockPageWithFormAndCheckGroup() {
45: Form form = new Form("form");
46: add(form);
47:
48: CheckGroup checkGroup = new CheckGroup("checkGroup",
49: new PropertyModel(this , "selected"));
50: form.add(checkGroup);
51:
52: checkGroup.add(new Check("check1", new Model(new Integer(1))));
53: checkGroup.add(new Check("check2", new Model(new Integer(2))));
54:
55: add(new AjaxSubmitLink("submitLink", form) {
56: private static final long serialVersionUID = 1L;
57:
58: protected void onSubmit(AjaxRequestTarget target, Form form) {
59: }
60: });
61: }
62:
63: /**
64: * @return selected
65: */
66: public List getSelected() {
67: return selected;
68: }
69:
70: /**
71: * @param selected
72: */
73: public void setSelected(List selected) {
74: this.selected = selected;
75: }
76: }
|