1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
package org.apache.tapestry.annotations; |
15 | |
|
16 | |
import java.util.Collection; |
17 | |
import java.util.Iterator; |
18 | |
|
19 | |
import org.apache.hivemind.ApplicationRuntimeException; |
20 | |
import org.apache.hivemind.HiveMind; |
21 | |
import org.apache.tapestry.enhance.EnhancementOperation; |
22 | |
import org.apache.tapestry.enhance.EnhancementWorker; |
23 | |
import org.apache.tapestry.spec.IComponentSpecification; |
24 | |
import org.apache.tapestry.spec.IContainedComponent; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | 0 | public class ComponentHousekeepingWorker implements EnhancementWorker |
36 | |
{ |
37 | |
public void performEnhancement( EnhancementOperation op, IComponentSpecification spec ) |
38 | |
{ |
39 | 0 | for ( Iterator i = spec.getComponentIds().iterator(); i.hasNext(); ) |
40 | |
{ |
41 | 0 | String id = ( String ) i.next(); |
42 | 0 | IContainedComponent cc = spec.getComponent(id); |
43 | 0 | String copyOf = cc.getCopyOf(); |
44 | 0 | Collection bindingNames = cc.getBindingNames(); |
45 | |
|
46 | 0 | if (HiveMind.isNonBlank(copyOf) && bindingNames.size() == 0) |
47 | |
{ |
48 | 0 | IContainedComponent source = spec.getComponent(copyOf); |
49 | 0 | if (source == null) |
50 | 0 | throw new ApplicationRuntimeException(AnnotationMessages.unableToCopy(copyOf)); |
51 | |
|
52 | 0 | AnnotationUtils.copyBindings(source, cc); |
53 | |
} |
54 | 0 | } |
55 | 0 | } |
56 | |
} |