KickJava   Java API By Example, From Geeks To Geeks.

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


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.portlets.nav.renderer.html;
6
7 import java.io.IOException JavaDoc;
8 import java.util.ResourceBundle JavaDoc;
9
10 import javax.faces.component.UIComponent;
11 import javax.faces.context.FacesContext;
12 import javax.faces.context.ResponseWriter;
13 import org.exoplatform.portlets.nav.component.UIMenu;
14 import org.exoplatform.portlets.nav.component.UINavigation;
15 import org.exoplatform.services.portal.model.Node;
16 /**
17  * Thu, May 5, 2004 @ 15:38
18  *
19  * @author: Tuan Nguyen
20  * @email: tuan08@users.sourceforge.net
21  * @version: $Id: ExoEditPageModeMenuRenderer.java,v 1.9 2004/10/19 13:20:03 benjmestrallet Exp $
22  */

23 public class ExoEditPageModeMenuRenderer extends ExoMenuRenderer {
24   
25   protected void renderNode(ResponseWriter w, UIMenu uiMenu, ResourceBundle JavaDoc res,
26                                   Node node, String JavaDoc ownerURI) throws IOException JavaDoc {
27     int childrenSize = node.getChildrenSize();
28     if (childrenSize == 0) return;
29     w.write("<ul>");
30     for (int i = 0; i < childrenSize; i++) {
31       Node child = node.getChild(i);
32       if(!child.isVisible()) continue ;
33       if (child.getChildrenSize() > 0) {
34         if (child.isSelectedPath()) {
35           w.write("<li class='expanded-child'>");
36         } else {
37           w.write("<li class='collapsed-child'>");
38         }
39       } else {
40         w.write("<li class='leaf'>");
41       }
42       w. write("<a HREF='"); w.write(ownerURI); w.write(child.getUri()); w.write("'>") ;
43       w. write(child.getResolvedLabel()) ;
44       w. write("</a>") ;
45       if (child.isSelectedPath()) {
46         renderNode(w, uiMenu, res, child, ownerURI);
47       }
48       w.write("</li>");
49     }
50     w.write("</ul>");
51   }
52
53   protected void renderAdmin(ResourceBundle JavaDoc res, ResponseWriter w, UIMenu uiMenu) throws IOException JavaDoc {
54     UIComponent uiChild = uiMenu.getUIToolbarPage();
55     uiChild.encodeBegin(FacesContext.getCurrentInstance());
56     uiChild.encodeChildren(FacesContext.getCurrentInstance());
57     uiChild.encodeEnd(FacesContext.getCurrentInstance());
58   }
59 }
Popular Tags