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.spinner;
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 renders the spinner component
29 *
30 * @author : Peter Symoens (Last modified by $Author: schauwvliege $)
31 * @version $Revision: 1.6 $ - $Date: 2005/09/13 08:11:06 $:
32 */
33 public class SpinnerRenderer extends Renderer{
34
35 /***
36 *
37 */
38 protected static final String MORE = ".more";
39
40 /***
41 *
42 */
43 protected static final String LESS = ".less";
44
45 /***
46 *
47 * @param spinner The UIComponent
48 * @param writer The ResponseWriter
49 * @param clientId The component's client id
50 * @throws IOException e
51 */
52 protected void encodeDecrementButton(UIComponent spinner,
53 ResponseWriter writer, String clientId) throws IOException {
54 writer.startElement("input", spinner);
55 writer.writeAttribute("type", "submit", null);
56 writer.writeAttribute("name", clientId + LESS, null);
57 writer.writeAttribute("value", "<", "value");
58 writer.endElement("input");
59 }
60
61 /***
62 *
63 * @param spinner The UIComponent
64 * @param writer The ResponseWriter
65 * @param clientId The component's client id
66 * @throws IOException e
67 */
68 protected void encodeIncrementButton(UIComponent spinner,
69 ResponseWriter writer, String clientId) throws IOException {
70 writer.startElement("input", spinner);
71 writer.writeAttribute("type", "submit", null);
72 writer.writeAttribute("name", clientId + MORE, null);
73 writer.writeAttribute("value", ">", "value");
74
75
76 writer.endElement("input");
77 }
78
79 }
80
81 /***
82 * $Log: SpinnerRenderer.java,v $
83 * Revision 1.6 2005/09/13 08:11:06 schauwvliege
84 * organize imports
85 *
86 * Revision 1.5 2005/08/30 14:55:17 psong09
87 * cleanup
88 *
89 * Revision 1.4 2005/08/30 13:07:46 psong09
90 * renamed author: psong09
91 *
92 * Revision 1.3 2005/08/29 12:45:01 psong09
93 * moved spinner actionListener to ItemAction
94 *
95 */