1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.renderkit.html; |
20 | |
|
21 | |
import java.io.IOException; |
22 | |
|
23 | |
import javax.faces.component.UIComponent; |
24 | |
import javax.faces.context.FacesContext; |
25 | |
|
26 | |
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer; |
27 | |
import org.apache.myfaces.shared.renderkit.html.HtmlRenderer; |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
@JSFRenderer(renderKitId = "HTML_BASIC", family = "javax.faces.Output", type = "javax.faces.CompositeFacet") |
35 | 0 | public class HtmlCompositeFacetRenderer extends HtmlRenderer |
36 | |
{ |
37 | |
|
38 | |
public boolean getRendersChildren() |
39 | |
{ |
40 | 0 | return true; |
41 | |
} |
42 | |
|
43 | |
public void encodeBegin(FacesContext context, UIComponent component) |
44 | |
throws IOException |
45 | |
{ |
46 | 0 | } |
47 | |
|
48 | |
public void encodeChildren(FacesContext context, UIComponent component) |
49 | |
throws IOException |
50 | |
{ |
51 | 0 | if (context == null) |
52 | |
{ |
53 | 0 | throw new NullPointerException("context"); |
54 | |
} |
55 | 0 | if (component == null) |
56 | |
{ |
57 | 0 | throw new NullPointerException("component"); |
58 | |
} |
59 | |
|
60 | 0 | String facetName = (String) component.getAttributes().get(UIComponent.FACETS_KEY); |
61 | |
|
62 | 0 | if (facetName == null) |
63 | |
{ |
64 | 0 | throw new IOException("Composite facet name under key UIComponent.FACETS_KEY not found "+ |
65 | |
component.getClientId(context)); |
66 | |
} |
67 | |
|
68 | 0 | UIComponent compositeComponent = UIComponent.getCurrentCompositeComponent(context); |
69 | |
|
70 | 0 | if (compositeComponent == null) |
71 | |
{ |
72 | 0 | throw new IOException("parent Composite Component not found when rendering composite component facet "+ |
73 | |
component.getClientId(context)); |
74 | |
} |
75 | |
|
76 | 0 | UIComponent compositeFacet = (UIComponent) compositeComponent.getFacet(facetName); |
77 | |
|
78 | 0 | if (compositeFacet != null) |
79 | |
{ |
80 | 0 | compositeFacet.encodeAll(context); |
81 | |
} |
82 | 0 | } |
83 | |
|
84 | |
public void encodeEnd(FacesContext context, UIComponent component) |
85 | |
throws IOException |
86 | |
{ |
87 | 0 | } |
88 | |
} |