|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| package org.apache.tapestry.pageload; |
|
16 |
| |
|
17 |
| import java.util.Iterator; |
|
18 |
| |
|
19 |
| import org.apache.tapestry.IBinding; |
|
20 |
| import org.apache.tapestry.IComponent; |
|
21 |
| import org.apache.tapestry.spec.IComponentSpecification; |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| class QueuedInheritInformalBindings implements IQueuedInheritedBinding |
|
30 |
| { |
|
31 |
| private IComponent _component; |
|
32 |
| |
|
33 |
3
| QueuedInheritInformalBindings(IComponent component)
|
|
34 |
| { |
|
35 |
3
| _component = component;
|
|
36 |
| } |
|
37 |
| |
|
38 |
3
| public void connect()
|
|
39 |
| { |
|
40 |
| |
|
41 |
3
| IComponent container = _component.getContainer();
|
|
42 |
| |
|
43 |
3
| for (Iterator it = container.getBindingNames().iterator(); it.hasNext();)
|
|
44 |
| { |
|
45 |
15
| String bindingName = (String) it.next();
|
|
46 |
15
| connectInformalBinding(container, _component, bindingName);
|
|
47 |
| } |
|
48 |
| } |
|
49 |
| |
|
50 |
15
| private void connectInformalBinding(
|
|
51 |
| IComponent container, |
|
52 |
| IComponent component, |
|
53 |
| String bindingName) |
|
54 |
| { |
|
55 |
15
| IComponentSpecification componentSpec = component.getSpecification();
|
|
56 |
15
| IComponentSpecification containerSpec = container.getSpecification();
|
|
57 |
| |
|
58 |
| |
|
59 |
15
| if (component.getBinding(bindingName) != null)
|
|
60 |
0
| return;
|
|
61 |
| |
|
62 |
| |
|
63 |
15
| if (componentSpec.getParameter(bindingName) != null
|
|
64 |
| || componentSpec.isReservedParameterName(bindingName)) |
|
65 |
6
| return;
|
|
66 |
| |
|
67 |
| |
|
68 |
9
| if (containerSpec.getParameter(bindingName) != null
|
|
69 |
| || containerSpec.isReservedParameterName(bindingName)) |
|
70 |
0
| return;
|
|
71 |
| |
|
72 |
| |
|
73 |
9
| IBinding binding = container.getBinding(bindingName);
|
|
74 |
9
| component.setBinding(bindingName, binding);
|
|
75 |
| } |
|
76 |
| } |