1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.richclient.form;
17
18 import org.springframework.binding.form.FormModel;
19 import org.springframework.binding.form.HierarchicalFormModel;
20 import org.springframework.binding.form.ValidatingFormModel;
21 import org.springframework.binding.form.support.DefaultFormModel;
22 import org.springframework.binding.support.TestBean;
23 import org.springframework.binding.value.ValueModel;
24 import org.springframework.richclient.test.SpringRichTestCase;
25
26 import javax.swing.*;
27
28
29
30
31
32 public abstract class AbstractFormTests extends SpringRichTestCase {
33
34
35
36
37
38 public void testAddChildForm() {
39 TestBean testBean = new TestBean();
40 testBean.setNestedProperty(new TestBean());
41 HierarchicalFormModel model = new DefaultFormModel(testBean);
42 ValidatingFormModel childModel = FormModelHelper.createChildPageFormModel(model, "test", "nestedProperty");
43 AbstractForm form = new TestAbstractForm(model);
44 form.addChildForm(new TestAbstractForm(childModel));
45 }
46
47 private static class TestAbstractForm extends AbstractForm {
48
49 public TestAbstractForm() {
50 super();
51 }
52
53 public TestAbstractForm(FormModel formModel, String formId) {
54 super(formModel, formId);
55 }
56
57 public TestAbstractForm(FormModel pageFormModel) {
58 super(pageFormModel);
59 }
60
61 public TestAbstractForm(HierarchicalFormModel parentFormModel, String formId, ValueModel childFormObjectHolder) {
62 super(parentFormModel, formId, childFormObjectHolder);
63 }
64
65 public TestAbstractForm(String formId) {
66 super(formId);
67 }
68
69 public TestAbstractForm(Object formObject) {
70 super(formObject);
71 }
72
73 public TestAbstractForm(HierarchicalFormModel parentFormModel, String formId, String childFormObjectPropertyPath) {
74 super(parentFormModel, formId, childFormObjectPropertyPath);
75 }
76
77 protected JComponent createFormControl() {
78 return null;
79 }
80
81 }
82 }