1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.tapestry.valid; |
16 |
| |
17 |
| import org.apache.hivemind.ApplicationRuntimeException; |
18 |
| import org.apache.hivemind.Location; |
19 |
| import org.apache.hivemind.lib.BeanFactory; |
20 |
| import org.apache.tapestry.IBinding; |
21 |
| import org.apache.tapestry.IComponent; |
22 |
| import org.apache.tapestry.binding.BindingFactory; |
23 |
| import org.apache.tapestry.coerce.ValueConverter; |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| public class ValidatorBindingFactory implements BindingFactory |
34 |
| { |
35 |
| private BeanFactory _validatorBeanFactory; |
36 |
| |
37 |
| private ValueConverter _valueConverter; |
38 |
| |
39 |
1
| public void setValidatorBeanFactory(BeanFactory validatorBeanFactory)
|
40 |
| { |
41 |
1
| _validatorBeanFactory = validatorBeanFactory;
|
42 |
| } |
43 |
| |
44 |
1
| public void setValueConverter(ValueConverter valueConverter)
|
45 |
| { |
46 |
1
| _valueConverter = valueConverter;
|
47 |
| } |
48 |
| |
49 |
| |
50 |
| |
51 |
| |
52 |
| |
53 |
| |
54 |
| |
55 |
1
| public IBinding createBinding(IComponent root, String bindingDescription, String path,
|
56 |
| Location location) |
57 |
| { |
58 |
1
| try
|
59 |
| { |
60 |
1
| IValidator validator = (IValidator) _validatorBeanFactory.get(path);
|
61 |
| |
62 |
1
| return new ValidatorBinding(bindingDescription, _valueConverter, location, validator);
|
63 |
| } |
64 |
| catch (Exception ex) |
65 |
| { |
66 |
0
| throw new ApplicationRuntimeException(ex.getMessage(), location, ex);
|
67 |
| } |
68 |
| } |
69 |
| |
70 |
| } |