1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.richclient.form.binding.swing;
17
18 import java.util.Map;
19
20 import javax.swing.JComponent;
21
22 import org.springframework.binding.form.FormModel;
23 import org.springframework.richclient.form.binding.Binder;
24 import org.springframework.richclient.form.binding.BinderSelectionStrategy;
25 import org.springframework.richclient.form.binding.Binding;
26
27
28
29
30 public class TestingBinderSelectionStrategy implements BinderSelectionStrategy {
31
32 public Binder selectBinder(FormModel formModel, String propertyName) {
33 return new TestableBinder(null);
34 }
35
36 public Binder selectBinder(Class controlType, FormModel formModel, String propertyName) {
37 return new TestableBinder(controlType);
38 }
39
40 private class TestableBinder implements Binder {
41 private Class controlType;
42
43 public TestableBinder(Class controlType) {
44 this.controlType = controlType;
45 }
46
47 public Binding bind(FormModel formModel, String formPropertyPath, Map context) {
48 return new TestableBinding(controlType, null, formModel,formPropertyPath, context);
49 }
50
51 public Binding bind(JComponent control, FormModel formModel, String formPropertyPath, Map context) {
52 return new TestableBinding(controlType, control, formModel,formPropertyPath, context);
53 }
54
55 public Class getRequiredSourceClass() {
56
57 return null;
58 }
59 }
60 }