KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portal > faces > renderer > html > page > PagePreviewRenderer


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.portal.faces.renderer.html.page;
6
7 import java.io.IOException JavaDoc;
8 import java.util.List JavaDoc;
9 import javax.faces.component.UIComponent;
10 import javax.faces.context.FacesContext;
11 import javax.faces.context.ResponseWriter;
12 import org.exoplatform.faces.core.component.UIToolbar;
13 import org.exoplatform.faces.core.renderer.html.HtmlBasicRenderer;
14 import org.exoplatform.portal.faces.component.UIPagePreview;
15 /**
16  * @email: tuan08@users.sourceforge.net
17  * @version: $Id: PagePreviewRenderer.java,v 1.5 2004/09/29 17:44:51
18  * benjmestrallet Exp $
19  */

20 public class PagePreviewRenderer extends HtmlBasicRenderer {
21
22   final public void encodeChildren(FacesContext context, UIComponent component)
23       throws IOException JavaDoc {
24     UIPagePreview uiComponent = (UIPagePreview) component;
25     ResponseWriter w = context.getResponseWriter();
26     w.write("<div class='UIPagePreview'>");
27     UIComponent uiToolbar = uiComponent.getUIToolbar();
28     uiToolbar.encodeBegin(context);
29     uiToolbar.encodeChildren(context);
30     uiToolbar.encodeEnd(context);
31     w.write("<div class='page'>");
32
33     List JavaDoc children = component.getChildren();
34     for (int i = 0; i < children.size(); i++) {
35       UIComponent uiChild = (UIComponent) children.get(i);
36       if (uiChild.isRendered() && !(uiChild instanceof UIToolbar)) {
37         uiChild.encodeBegin(context);
38         uiChild.encodeChildren(context);
39         uiChild.encodeEnd(context);
40       }
41     }
42
43     w.write("</div>");
44     w.write("</div>");
45   }
46 }
Popular Tags