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 |
12
| protected MessageBinding(String description, ValueConverter valueConverter, Location location,
|
39 |
| IComponent component, String key) |
40 |
| { |
41 |
12
| super(description, valueConverter, location);
|
42 |
| |
43 |
12
| Defense.notNull(component, "component");
|
44 |
12
| Defense.notNull(key, "key");
|
45 |
| |
46 |
12
| _component = component;
|
47 |
12
| _key = key;
|
48 |
| } |
49 |
| |
50 |
1
| public Object getComponent()
|
51 |
| { |
52 |
1
| return _component;
|
53 |
| } |
54 |
| |
55 |
1
| public String getKey()
|
56 |
| { |
57 |
1
| return _key;
|
58 |
| } |
59 |
| |
60 |
| |
61 |
| |
62 |
| |
63 |
| |
64 |
13
| public Object getObject()
|
65 |
| { |
66 |
13
| return _component.getMessages().getMessage(_key);
|
67 |
| } |
68 |
| |
69 |
1
| public String toString()
|
70 |
| { |
71 |
1
| StringBuffer buffer = new StringBuffer("StringBinding");
|
72 |
1
| buffer.append('[');
|
73 |
1
| buffer.append(_component.getExtendedId());
|
74 |
1
| buffer.append(' ');
|
75 |
1
| buffer.append(_key);
|
76 |
1
| buffer.append(']');
|
77 |
| |
78 |
1
| return buffer.toString();
|
79 |
| } |
80 |
| } |