1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.tapestry.form.translator; |
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.AbstractBindingFactory; |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| public class TranslatorBindingFactory extends AbstractBindingFactory |
33 |
| { |
34 |
| private BeanFactory _translatorBeanFactory; |
35 |
| |
36 |
2
| public IBinding createBinding(IComponent root, String bindingDescription, String path,
|
37 |
| Location location) |
38 |
| { |
39 |
2
| try
|
40 |
| { |
41 |
2
| Translator translator = (Translator) _translatorBeanFactory.get(path);
|
42 |
| |
43 |
1
| return new TranslatorBinding(bindingDescription, getValueConverter(), location,
|
44 |
| translator); |
45 |
| } |
46 |
| catch (Exception ex) |
47 |
| { |
48 |
1
| throw new ApplicationRuntimeException(ex.getMessage(), location, ex);
|
49 |
| } |
50 |
| } |
51 |
| |
52 |
2
| public void setTranslatorBeanFactory(BeanFactory translatorBeanFactory)
|
53 |
| { |
54 |
2
| _translatorBeanFactory = translatorBeanFactory;
|
55 |
| } |
56 |
| } |