Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RenderKit |
|
| 1.5454545454545454;1.545 |
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.OutputStream; | |
22 | import java.io.Writer; | |
23 | import java.util.Collections; | |
24 | import java.util.HashMap; | |
25 | import java.util.Iterator; | |
26 | import java.util.List; | |
27 | ||
28 | import javax.faces.context.ResponseStream; | |
29 | import javax.faces.context.ResponseWriter; | |
30 | ||
31 | /** | |
32 | * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a> | |
33 | */ | |
34 | public abstract class RenderKit | |
35 | { | |
36 | private HashMap<String, ClientBehaviorRenderer> clientBehaviorRenderers; | |
37 | ||
38 | public RenderKit () | |
39 | 520 | { |
40 | 520 | this.clientBehaviorRenderers = new HashMap<String, ClientBehaviorRenderer>(); |
41 | 520 | } |
42 | ||
43 | public void addClientBehaviorRenderer(String type, ClientBehaviorRenderer renderer) | |
44 | { | |
45 | 0 | if (type == null) |
46 | { | |
47 | 0 | throw new NullPointerException ("type is null"); |
48 | } | |
49 | ||
50 | 0 | if (renderer == null) |
51 | { | |
52 | 0 | throw new NullPointerException ("renderer is null"); |
53 | } | |
54 | ||
55 | 0 | this.clientBehaviorRenderers.put (type, renderer); |
56 | 0 | } |
57 | ||
58 | public abstract void addRenderer(String family, String rendererType, Renderer renderer); | |
59 | ||
60 | public abstract ResponseStream createResponseStream(OutputStream out); | |
61 | ||
62 | public abstract ResponseWriter createResponseWriter(Writer writer, String contentTypeList, | |
63 | String characterEncoding); | |
64 | ||
65 | public ClientBehaviorRenderer getClientBehaviorRenderer(String type) | |
66 | { | |
67 | 0 | if (type == null) |
68 | { | |
69 | 0 | throw new NullPointerException ("type is null"); |
70 | } | |
71 | ||
72 | 0 | return this.clientBehaviorRenderers.get (type); |
73 | } | |
74 | ||
75 | public Iterator<String> getClientBehaviorRendererTypes() | |
76 | { | |
77 | 0 | return this.clientBehaviorRenderers.keySet().iterator(); |
78 | } | |
79 | ||
80 | /** | |
81 | * <p> | |
82 | * Return an <code>Iterator</code> over the component-family entries supported by this <code>RenderKit</code> | |
83 | * instance. | |
84 | * </p> | |
85 | * | |
86 | * <p> | |
87 | * The default implementation of this method returns an empty <code>Iterator</code> | |
88 | * </p> | |
89 | * | |
90 | * @return an iterator over the component families supported by this <code>RenderKit</code>. | |
91 | * | |
92 | * @since 2.0 | |
93 | */ | |
94 | public Iterator<String> getComponentFamilies() | |
95 | { | |
96 | 0 | List<String> emptyList = Collections.emptyList(); |
97 | ||
98 | 0 | return emptyList.iterator(); |
99 | } | |
100 | ||
101 | public abstract Renderer getRenderer(String family, String rendererType); | |
102 | ||
103 | /** | |
104 | * <p> | |
105 | * Return an <code>Iterator</code> over the renderer-type entries for the given component-family. | |
106 | * </p> | |
107 | * | |
108 | * <p> | |
109 | * If the specified <code>componentFamily</code> is not known to this <code>RenderKit</code> implementation, return | |
110 | * an empty <code>Iterator</code> | |
111 | * </p> | |
112 | * | |
113 | * <p> | |
114 | * The default implementation of this method returns an empty <code>Iterator</code> | |
115 | * </p> | |
116 | * | |
117 | * @param componentFamily | |
118 | * one of the members of the <code>Iterator</code> returned by {@link #getComponentFamilies()} | |
119 | * | |
120 | * @return an iterator over the renderer-type entries for the given component-family. | |
121 | * | |
122 | * @since 2.0 | |
123 | */ | |
124 | public Iterator<String> getRendererTypes(String componentFamily) | |
125 | { | |
126 | 0 | List<String> emptyList = Collections.emptyList(); |
127 | ||
128 | 0 | return emptyList.iterator(); |
129 | } | |
130 | ||
131 | public abstract ResponseStateManager getResponseStateManager(); | |
132 | } |