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.component;
20
21 import java.io.IOException;
22 import java.util.Map;
23
24 import javax.faces.component.UIComponent;
25 import javax.faces.context.FacesContext;
26 import javax.faces.context.ResponseWriter;
27 import javax.faces.render.Renderer;
28
29 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
30
31 @JSFRenderer(family="facelets",
32 renderKitId="HTML_BASIC",
33 type="facelets.ui.Repeat")
34 public class RepeatRenderer extends Renderer
35 {
36
37 public RepeatRenderer()
38 {
39 super();
40 }
41
42 @Override
43 public void encodeBegin(FacesContext context, UIComponent component) throws IOException
44 {
45
46 }
47
48 @Override
49 public void encodeChildren(FacesContext context, UIComponent component) throws IOException
50 {
51 if (component.getChildCount() > 0)
52 {
53 Map<String, Object> a = component.getAttributes();
54 String tag = (String) a.get("alias.element");
55 if (tag != null)
56 {
57 ResponseWriter out = context.getResponseWriter();
58 out.startElement(tag, component);
59 String[] attrs = (String[]) a.get("alias.attributes");
60 String attr;
61 if (attrs != null)
62 {
63 for (int i = 0; i < attrs.length; i++)
64 {
65 attr = attrs[i];
66 if ("styleClass".equals(attr))
67 {
68 attr = "class";
69 }
70 out.writeAttribute(attr, a.get(attrs[i]), attrs[i]);
71 }
72 }
73 }
74
75 for (int i = 0, childCount = component.getChildCount(); i < childCount; i++)
76 {
77 UIComponent child = component.getChildren().get(i);
78 child.encodeAll(context);
79 }
80
81 if (tag != null)
82 {
83 context.getResponseWriter().endElement(tag);
84 }
85 }
86 }
87
88 @Override
89 public void encodeEnd(FacesContext context, UIComponent component) throws IOException
90 {
91
92 }
93
94 @Override
95 public boolean getRendersChildren()
96 {
97 return true;
98 }
99
100 }