1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.view.facelets.tag.jsf.core; |
20 | |
|
21 | |
import java.io.IOException; |
22 | |
import java.util.Map; |
23 | |
import javax.faces.component.UIComponent; |
24 | |
import javax.faces.view.facelets.FaceletContext; |
25 | |
import javax.faces.view.facelets.TagAttribute; |
26 | |
import javax.faces.view.facelets.TagConfig; |
27 | |
import javax.faces.view.facelets.TagException; |
28 | |
import javax.faces.view.facelets.TagHandler; |
29 | |
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
@JSFFaceletTag( |
37 | |
name = "f:passThroughAttributes", |
38 | |
bodyContent = "empty") |
39 | |
public final class PassThroughAttributesHandler extends TagHandler |
40 | |
{ |
41 | |
private final TagAttribute _value; |
42 | |
|
43 | |
public PassThroughAttributesHandler(TagConfig config) |
44 | |
{ |
45 | 0 | super(config); |
46 | 0 | _value = getRequiredAttribute("value"); |
47 | 0 | } |
48 | |
|
49 | |
public void apply(FaceletContext ctx, UIComponent parent) throws IOException |
50 | |
{ |
51 | 0 | if (parent == null) |
52 | |
{ |
53 | 0 | throw new TagException(this.tag, "Parent UIComponent was null"); |
54 | |
} |
55 | |
|
56 | |
|
57 | 0 | if (parent.getParent() == null) |
58 | |
{ |
59 | 0 | Map<String, Object> map = (Map<String, Object>) _value.getObject(ctx, Map.class); |
60 | |
|
61 | 0 | for (Map.Entry<String, Object> entry : map.entrySet()) |
62 | |
{ |
63 | 0 | parent.getPassThroughAttributes().put(entry.getKey(), entry.getValue()); |
64 | 0 | } |
65 | |
} |
66 | 0 | } |
67 | |
} |