|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| package org.apache.tapestry.binding; |
|
16 |
| |
|
17 |
| import org.apache.hivemind.Location; |
|
18 |
| import org.apache.hivemind.util.Defense; |
|
19 |
| import org.apache.tapestry.IComponent; |
|
20 |
| import org.apache.tapestry.coerce.ValueConverter; |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| public class MessageBinding extends AbstractBinding |
|
33 |
| { |
|
34 |
| private final IComponent _component; |
|
35 |
| |
|
36 |
| private final String _key; |
|
37 |
| |
|
38 |
36
| protected MessageBinding(String description, ValueConverter valueConverter, Location location,
|
|
39 |
| IComponent component, String key) |
|
40 |
| { |
|
41 |
36
| super(description, valueConverter, location);
|
|
42 |
| |
|
43 |
36
| Defense.notNull(component, "component");
|
|
44 |
36
| Defense.notNull(key, "key");
|
|
45 |
| |
|
46 |
36
| _component = component;
|
|
47 |
36
| _key = key;
|
|
48 |
| } |
|
49 |
| |
|
50 |
3
| public Object getComponent()
|
|
51 |
| { |
|
52 |
3
| return _component;
|
|
53 |
| } |
|
54 |
| |
|
55 |
3
| public String getKey()
|
|
56 |
| { |
|
57 |
3
| return _key;
|
|
58 |
| } |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| |
|
63 |
| |
|
64 |
39
| public Object getObject()
|
|
65 |
| { |
|
66 |
39
| return _component.getMessages().getMessage(_key);
|
|
67 |
| } |
|
68 |
| |
|
69 |
3
| public String toString()
|
|
70 |
| { |
|
71 |
3
| StringBuffer buffer = new StringBuffer("StringBinding");
|
|
72 |
3
| buffer.append('[');
|
|
73 |
3
| buffer.append(_component.getExtendedId());
|
|
74 |
3
| buffer.append(' ');
|
|
75 |
3
| buffer.append(_key);
|
|
76 |
3
| buffer.append(']');
|
|
77 |
| |
|
78 |
3
| return buffer.toString();
|
|
79 |
| } |
|
80 |
| } |