1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.teeda.core.config.faces.assembler.impl; |
17 | |
|
18 | |
import java.util.Iterator; |
19 | |
import java.util.Map; |
20 | |
|
21 | |
import javax.faces.application.Application; |
22 | |
|
23 | |
import org.seasar.teeda.core.config.faces.assembler.ComponentAssembler; |
24 | |
import org.seasar.teeda.core.config.faces.element.ComponentElement; |
25 | |
import org.seasar.teeda.core.util.ApplicationUtil; |
26 | |
import org.seasar.teeda.core.util.IteratorUtil; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
public class DefaultComponentAssembler extends ComponentAssembler { |
32 | |
|
33 | |
private Application application_; |
34 | |
|
35 | |
public DefaultComponentAssembler(Map components) { |
36 | 3 | super(components); |
37 | 3 | } |
38 | |
|
39 | |
protected void setupBeforeAssemble() { |
40 | 3 | application_ = ApplicationUtil.getApplicationFromFactory(); |
41 | 3 | } |
42 | |
|
43 | |
public void assemble() { |
44 | 3 | String componentType = null; |
45 | 3 | String componentClassName = null; |
46 | 3 | ComponentElement component = null; |
47 | 3 | for (Iterator itr = IteratorUtil.getEntryIterator(getComponents()); itr |
48 | 5 | .hasNext();) { |
49 | 2 | Map.Entry entry = (Map.Entry) itr.next(); |
50 | 2 | componentType = (String) entry.getKey(); |
51 | 2 | component = (ComponentElement) entry.getValue(); |
52 | 2 | componentClassName = component.getComponentClass(); |
53 | 2 | application_.addComponent(componentType, componentClassName); |
54 | |
} |
55 | 3 | } |
56 | |
|
57 | |
} |