KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > nav > renderer > html > NavigationEditRenderer


1 package org.exoplatform.portlets.nav.renderer.html;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.faces.component.UIComponent;
6 import javax.faces.context.FacesContext;
7 import javax.faces.context.ResponseWriter;
8 import javax.faces.render.Renderer;
9 import org.exoplatform.faces.FacesConstants;
10 import org.exoplatform.portlets.nav.component.UINavigation;
11
12
13 /**
14  *
15  * @version $Revision: 1.1.1.1 $ $Date: 2004/08/05 13:11:14 $
16  * @author Fahrid Djebbari
17  *
18  */

19
20 public class NavigationEditRenderer extends Renderer
21 {
22     private static String JavaDoc FACE_FORM = "navigationEdit";
23     private static String JavaDoc FACE_ACTION_SAVE = "faceActionSave";
24     private static String JavaDoc FACE_ACTION_CANCEL = "faceActionCancel";
25     
26     public void encodeBegin(FacesContext context,UIComponent component) throws IOException JavaDoc
27     {
28         ResponseWriter writer = context.getResponseWriter();
29         
30         String JavaDoc actionURL = context.getExternalContext().encodeActionURL(null);
31         
32         writer.write("<form name=\"" + FACE_FORM + "\" method=\"post\" action=\"" + actionURL + "\">");
33         writer.write("<input type=\"hidden\" name=\"" + FacesConstants.ACTION + "\" value=\"" + FACE_ACTION_CANCEL + "\">");
34         writer.write("<input type=\"hidden\" name=\"" + FacesConstants.COMPONENT + "\" value=\"" + UINavigation.DEFAULT_RENDERER_TYPE + "\">");
35         
36         writer.write("<table>");
37         
38         writer.write("<tr>");
39         writer.write("<td><label>Menu</label></td>");
40         writer.write("<td>");
41         writer.write("<select name=\"renderer\">");
42         
43         writer.write("<option value=\"HorizontalMenuRenderer\">Horizontal Menu</option>");
44         writer.write("<option value=\"BreadcrumbsRenderer\">Breadcrumbs</option>");
45         
46         writer.write("</select>");
47         writer.write("</td>");
48         writer.write("</tr>");
49 /*
50         writer.write("<tr>");
51         writer.write("<td><label>Level</label></td>");
52         writer.write("<td>");
53         writer.write("<input name=\"level\" type=\"text\" value=\"\" size=\"2\" maxlength=\"2\">");
54         writer.write("</td>");
55         writer.write("</tr>");
56         
57         writer.write("<tr>");
58         writer.write("<td><label>Depth</label></td>");
59         writer.write("<td>");
60         writer.write("<input name=\"depth\" type=\"text\" value=\"\" size=\"2\" maxlength=\"2\">");
61         writer.write("</td>");
62         writer.write("</tr>");
63 */

64         writer.write("<tr>");
65         writer.write("<td colspan=\"2\">");
66         writer.write("<a HREF=\"javascript: document." + FACE_FORM + ".elements['" + FacesConstants.ACTION + "'].value = '" + FACE_ACTION_SAVE + "';document." + FACE_FORM + ".submit();\">Save</a>");
67         writer.write("<a HREF=\"javascript: document." + FACE_FORM + ".elements['" + FacesConstants.ACTION + "'].value = '" + FACE_ACTION_CANCEL + "';document." + FACE_FORM + ".submit();\">Cancel</a>");
68         writer.write("</td>");
69         writer.write("</tr>");
70         
71         writer.write("</table>");
72         
73         writer.write("</form>");
74     }
75
76     public void encodeChildren(FacesContext context,UIComponent component) throws IOException JavaDoc
77     {
78     }
79
80     public void encodeEnd(FacesContext context,UIComponent component) throws IOException JavaDoc
81     {
82         ResponseWriter writer = context.getResponseWriter();
83         
84         writer.write("</form>");
85     }
86 }
87
Popular Tags