KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > content > display > component > UIContentPortlet


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.content.display.component;
6
7 import java.util.Enumeration;
8 import java.util.List;
9 import javax.faces.context.ExternalContext;
10 import javax.faces.context.FacesContext;
11 import javax.portlet.PortletPreferences;
12 import javax.portlet.PortletRequest;
13 import org.exoplatform.faces.core.component.UIPortlet;
14 import org.exoplatform.portlets.content.display.component.model.ContentConfig;
15 /**
16  * Wed, Dec 22, 2003 @ 23:14
17  * @author: Tuan Nguyen
18  * @email: tuan08@users.sourceforge.net
19  * @version: $Id: UIContentPortlet.java,v 1.2 2004/07/26 02:27:18 tuan08 Exp $
20  */

21 public class UIContentPortlet extends UIPortlet {
22     
23     final static public String[] DEFAULT_VALUES = { "title=", "uri=", "encoding="};
24     
25     public UIContentPortlet() throws Exception {
26         setClazz("UIContentPortlet");
27     setRendererType("PyramidTabBarRenderer") ;
28         ExternalContext eContext = FacesContext.getCurrentInstance().getExternalContext();
29         PortletRequest request = (PortletRequest) eContext.getRequest();
30         PortletPreferences prefs = request.getPreferences();
31         Enumeration enum = prefs.getNames();
32         List children = getChildren();
33         boolean select = true;
34         while (enum.hasMoreElements()) {
35             String name = (String) enum.nextElement();
36             String[] values = prefs.getValues(name, DEFAULT_VALUES);
37             ContentConfig contentConfig = new ContentConfig(name, values);
38             UIContentTab uiContentTab = createUIContentTab(contentConfig);
39             uiContentTab.setId("id" + Integer.toString(uiContentTab.hashCode()));
40             uiContentTab.setRendered(select);
41             children.add(uiContentTab);
42             select = false;
43         }
44     }
45   
46   protected UIContentTab createUIContentTab(ContentConfig contentConfig) throws Exception{
47     return new UIContentTab(contentConfig);
48   }
49 }
Popular Tags