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