1 /***
2 * Copyright (C) 2005 The Java Community
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 2 of the License, or (at your option) any later
7 * version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place, Suite 330, Boston, MA 02111-1307 USA.
17 *
18 */
19 package org.bejug.javacareers.common.view.jsf.utils;
20
21 import java.io.IOException;
22
23 import javax.faces.component.UIComponent;
24 import javax.faces.context.ResponseWriter;
25 import javax.faces.render.Renderer;
26
27 /***
28 * This class holds methods common to the component renderers
29 *
30 * @author : Peter Symoens (Last modified by $Author: schauwvliege $)
31 * @version $Revision: 1.9 $ - $Date: 2005/09/06 13:22:50 $:
32 */
33 public class HtmlRenderer extends Renderer {
34
35 /***
36 *
37 */
38 private ResponseWriter writer;
39
40 /***
41 *
42 */
43 private UIComponent component;
44
45
46
47
48 /***
49 * Encode's the html open table tag.
50 *
51 * @throws java.io.IOException e
52 */
53 protected void openTable() throws IOException {
54 newLine();
55 writer.write("<table>");
56 newLine();
57 }
58
59
60 /***
61 * Encode's the html close table tag.
62 *
63 * @throws IOException e
64 */
65 protected void closeTable() throws IOException {
66 writer.write("</table>");
67 newLine();
68 }
69
70 /***
71 * Encode's the html open table cell tag.
72 *
73 * @throws IOException e
74 */
75 protected void openTableCell() throws IOException {
76 writer.write("<td>");
77 newLine();
78 }
79
80 /***
81 * Encode's the html open table row tag.
82 *
83 * @throws IOException e
84 */
85 protected void openTableRow() throws IOException {
86 writer.write("<tr>");
87 newLine();
88 }
89
90 /***
91 * Encode's the html close table row tag.
92 *
93 * @throws IOException e
94 */
95 protected void closeTableRow() throws IOException {
96 writer.write("</tr>");
97 newLine();
98 }
99
100 /***
101 * Encode's the html close table cell tag.
102 *
103 * @throws IOException e
104 */
105 protected void closeTableCell() throws IOException {
106 writer.write("</td>");
107 newLine();
108 }
109
110 /***
111 * @throws IOException e
112 */
113
114
115 protected void newLine() throws IOException {
116 writer.write("\n");
117 }
118
119 /***
120 *
121 * @param writer The ResponseWriter to set.
122 */
123 public void setWriter(ResponseWriter writer) {
124 this.writer = writer;
125 }
126
127 /***
128 *
129 * @param component The Component to set.
130 */
131 public void setComponent(UIComponent component) {
132 this.component = component;
133 }
134
135 /***
136 *
137 * @return the UIComponent this renderer is defined for.
138 */
139 public UIComponent getComponent() {
140 return component;
141 }
142
143
144 }
145
146 /***
147 * $Log: HtmlRenderer.java,v $
148 * Revision 1.9 2005/09/06 13:22:50 schauwvliege
149 * Intro of interview
150 *
151 * Revision 1.8 2005/08/30 14:10:55 psong09
152 * added javadoc
153 *
154 * Revision 1.7 2005/08/30 13:07:46 psong09
155 * renamed author: psong09
156 *
157 * Revision 1.6 2005/08/24 12:32:12 psong09
158 * Added spinner component and renamed commentAction
159 *
160 * Revision 1.5 2005/08/10 09:04:47 bavo_jcs
161 * Optimized imports according to checkstyle
162 *
163 * Revision 1.4 2005/08/09 12:59:54 bavo_jcs
164 * Optimized imports
165 *
166 * Revision 1.3 2005/08/08 12:31:51 bme_jcs
167 * resolved PMD errors
168 *
169 * Revision 1.2 2005/08/05 08:27:55 bme_jcs
170 * resolved checkstyle errors
171 *
172 * Revision 1.1 2005/07/12 15:59:05 psong09
173 * renamed tags package to utils and added HtmlRenderer
174 *
175 */