Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Renderer |
|
| 0.0;0 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, | |
13 | * software distributed under the License is distributed on an | |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | * KIND, either express or implied. See the License for the | |
16 | * specific language governing permissions and limitations | |
17 | * under the License. | |
18 | */ | |
19 | package javax.faces.render; | |
20 | ||
21 | import java.io.IOException; | |
22 | import java.util.List; | |
23 | ||
24 | import javax.faces.component.UIComponent; | |
25 | import javax.faces.context.FacesContext; | |
26 | import javax.faces.convert.ConverterException; | |
27 | ||
28 | /** | |
29 | * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a> | |
30 | * | |
31 | * @author Manfred Geiler (latest modification by $Author: skitching $) | |
32 | * @version $Revision: 676298 $ $Date: 2008-07-13 05:31:48 -0500 (Sun, 13 Jul 2008) $ | |
33 | */ | |
34 | 0 | public abstract class Renderer |
35 | { | |
36 | public void decode(FacesContext context, | |
37 | UIComponent component) | |
38 | { | |
39 | 0 | if (context == null) throw new NullPointerException("context"); |
40 | 0 | if (component == null) throw new NullPointerException("component"); |
41 | 0 | } |
42 | ||
43 | public void encodeBegin(FacesContext context, | |
44 | UIComponent component) | |
45 | throws IOException | |
46 | { | |
47 | 0 | if (context == null) throw new NullPointerException("context"); |
48 | 0 | if (component == null) throw new NullPointerException("component"); |
49 | 0 | } |
50 | ||
51 | /**Render all children if there are any. | |
52 | * | |
53 | * Note: this will only be called if getRendersChildren() | |
54 | * returns true. A component which has a renderer with | |
55 | * getRendersChildren() set to true will typically contain | |
56 | * the rendering logic for its children in this method. | |
57 | * | |
58 | * @param context | |
59 | * @param component | |
60 | * @throws IOException | |
61 | */ | |
62 | public void encodeChildren(FacesContext context, | |
63 | UIComponent component) | |
64 | throws IOException { | |
65 | 0 | if (context == null) throw new NullPointerException("context"); |
66 | 0 | if (component == null) throw new NullPointerException("component"); |
67 | ||
68 | 0 | if(component.getChildCount()>0) { |
69 | 0 | for (UIComponent child : component.getChildren()) { |
70 | 0 | if (!child.isRendered()) { |
71 | 0 | continue; |
72 | } | |
73 | ||
74 | 0 | child.encodeAll(context); |
75 | } | |
76 | } | |
77 | 0 | } |
78 | ||
79 | public void encodeEnd(FacesContext context, | |
80 | UIComponent component) | |
81 | throws IOException | |
82 | { | |
83 | 0 | if (context == null) throw new NullPointerException("context"); |
84 | 0 | if (component == null) throw new NullPointerException("component"); |
85 | 0 | } |
86 | ||
87 | public String convertClientId(FacesContext context, | |
88 | String clientId) | |
89 | { | |
90 | 0 | if (context == null) throw new NullPointerException("context"); |
91 | 0 | if (clientId == null) throw new NullPointerException("clientId"); |
92 | 0 | return clientId; |
93 | } | |
94 | ||
95 | /**Switch for deciding who renders the children. | |
96 | * | |
97 | * @return <b>true</b> - if the component takes care of rendering its | |
98 | * children. In this case, encodeChildren() ought to be called | |
99 | * by the rendering controller (e.g., the rendering controller | |
100 | * could be the method encodeAll() in UIComponent). | |
101 | * In the method encodeChildren(), the component | |
102 | * should therefore provide all children encode logic. | |
103 | * <br/> | |
104 | * <b>false</b> - if the component does not take care of rendering its | |
105 | * children. In this case, encodeChildren() should not be called | |
106 | * by the rendering controller. Instead, the children-list should | |
107 | * be retrieved and the children should directly be rendered by | |
108 | * the rendering controller one by one. | |
109 | */ | |
110 | public boolean getRendersChildren() | |
111 | { | |
112 | 0 | return false; |
113 | } | |
114 | ||
115 | public Object getConvertedValue(FacesContext context, | |
116 | UIComponent component, | |
117 | Object submittedValue) | |
118 | throws ConverterException | |
119 | { | |
120 | 0 | if (context == null) throw new NullPointerException("context"); |
121 | 0 | if (component == null) throw new NullPointerException("component"); |
122 | 0 | return submittedValue; |
123 | } | |
124 | ||
125 | } |