|
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.Collection; |
|
18 |
| import java.util.Iterator; |
|
19 |
| |
|
20 |
| import org.apache.tapestry.IComponent; |
|
21 |
| import org.apache.tapestry.Tapestry; |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| public class ComponentTreeWalker |
|
31 |
| { |
|
32 |
| private IComponentVisitor[] _visitors; |
|
33 |
| |
|
34 |
234
| public ComponentTreeWalker(IComponentVisitor[] visitors)
|
|
35 |
| { |
|
36 |
234
| _visitors = visitors;
|
|
37 |
| } |
|
38 |
| |
|
39 |
5862
| public void walkComponentTree(IComponent component)
|
|
40 |
| { |
|
41 |
| |
|
42 |
5862
| for (int i = 0; i < _visitors.length; i++)
|
|
43 |
| { |
|
44 |
5862
| IComponentVisitor visitor = _visitors[i];
|
|
45 |
5862
| visitor.visitComponent(component);
|
|
46 |
| } |
|
47 |
| |
|
48 |
| |
|
49 |
5862
| Collection components = component.getComponents().values();
|
|
50 |
| |
|
51 |
5862
| if (Tapestry.size(components) == 0)
|
|
52 |
4800
| return;
|
|
53 |
| |
|
54 |
1062
| for (Iterator it = components.iterator(); it.hasNext();)
|
|
55 |
| { |
|
56 |
5184
| IComponent embedded = (IComponent) it.next();
|
|
57 |
5184
| walkComponentTree(embedded);
|
|
58 |
| } |
|
59 |
| } |
|
60 |
| } |