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 |
1
| QueuedInheritInformalBindings(IComponent component)
|
34 |
| { |
35 |
1
| _component = component;
|
36 |
| } |
37 |
| |
38 |
1
| public void connect()
|
39 |
| { |
40 |
| |
41 |
1
| IComponent container = _component.getContainer();
|
42 |
| |
43 |
1
| for (Iterator it = container.getBindingNames().iterator(); it.hasNext();)
|
44 |
| { |
45 |
5
| String bindingName = (String) it.next();
|
46 |
5
| connectInformalBinding(container, _component, bindingName);
|
47 |
| } |
48 |
| } |
49 |
| |
50 |
5
| private void connectInformalBinding(
|
51 |
| IComponent container, |
52 |
| IComponent component, |
53 |
| String bindingName) |
54 |
| { |
55 |
5
| IComponentSpecification componentSpec = component.getSpecification();
|
56 |
5
| IComponentSpecification containerSpec = container.getSpecification();
|
57 |
| |
58 |
| |
59 |
5
| if (component.getBinding(bindingName) != null)
|
60 |
0
| return;
|
61 |
| |
62 |
| |
63 |
5
| if (componentSpec.getParameter(bindingName) != null
|
64 |
| || componentSpec.isReservedParameterName(bindingName)) |
65 |
2
| return;
|
66 |
| |
67 |
| |
68 |
3
| if (containerSpec.getParameter(bindingName) != null
|
69 |
| || containerSpec.isReservedParameterName(bindingName)) |
70 |
0
| return;
|
71 |
| |
72 |
| |
73 |
3
| IBinding binding = container.getBinding(bindingName);
|
74 |
3
| component.setBinding(bindingName, binding);
|
75 |
| } |
76 |
| } |