1 |
|
package org.apache.tapestry.pageload; |
2 |
|
|
3 |
|
import org.apache.hivemind.PoolManageable; |
4 |
|
import org.apache.tapestry.IComponent; |
5 |
|
import org.apache.tapestry.IForm; |
6 |
|
import org.apache.tapestry.IPage; |
7 |
|
import org.apache.tapestry.dojo.IWidget; |
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
0 |
public class ComponentTypeVisitor implements IComponentVisitor, PoolManageable { |
14 |
|
|
15 |
|
IPage _page; |
16 |
|
|
17 |
|
public void visitComponent(IComponent component) |
18 |
|
{ |
19 |
0 |
if (IPage.class.isInstance(component)) { |
20 |
|
|
21 |
0 |
_page = (IPage) component; |
22 |
0 |
return; |
23 |
|
} |
24 |
|
|
25 |
0 |
if (IForm.class.isInstance(component) && _page != null) { |
26 |
|
|
27 |
0 |
_page.setHasFormComponents(true); |
28 |
|
} |
29 |
|
|
30 |
0 |
if (IWidget.class.isInstance(component) && _page != null) { |
31 |
|
|
32 |
0 |
_page.setHasWidgets(true); |
33 |
|
} |
34 |
0 |
} |
35 |
|
|
36 |
|
public void activateService() |
37 |
|
{ |
38 |
0 |
_page = null; |
39 |
0 |
} |
40 |
|
|
41 |
|
public void passivateService() |
42 |
|
{ |
43 |
0 |
_page = null; |
44 |
0 |
} |
45 |
|
} |