KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > user > component > UIUserProfileSummary


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.user.component;
6
7 import java.util.Map JavaDoc;
8 import javax.faces.context.ExternalContext;
9 import javax.faces.context.FacesContext;
10 import javax.portlet.PortletRequest;
11 import org.exoplatform.faces.core.component.UIExoCommand;
12 import org.exoplatform.faces.core.event.ExoActionEvent;
13 import org.exoplatform.faces.core.event.ExoActionListener;
14 import org.exoplatform.services.organization.OrganizationService;
15 /**
16  * Sat, Jan 03, 2004 @ 11:16
17  * @author: Tuan Nguyen
18  * @email: tuan08@users.sourceforge.net
19  * @version: $Id: UIUserProfile.java,v 1.14 2004/09/28 18:19:23 tuan08 Exp $
20  */

21 public class UIUserProfileSummary extends UIExoCommand {
22   final static public String JavaDoc[] PERSONAL_INFO_KEYS = UIUserProfile.PERSONAL_INFO_KEYS ;
23   final static public String JavaDoc[] HOME_INFO_KEYS = UIUserProfile.HOME_INFO_KEYS ;
24   final static public String JavaDoc[] BUSINESE_INFO_KEYS = UIUserProfile.BUSINESE_INFO_KEYS ;
25  
26   private Map JavaDoc userInfoMap_ ;
27   private boolean showBackButton_ ;
28   private OrganizationService service_ ;
29    
30   public UIUserProfileSummary(OrganizationService service) throws Exception JavaDoc {
31     setId("UIUserProfile") ;
32     setRendererType("UserProfileRenderer") ;
33     service_ = service ;
34     ExternalContext eContext = FacesContext.getCurrentInstance().getExternalContext() ;
35     Map JavaDoc requestMap = eContext.getRequestMap() ;
36     userInfoMap_ = (Map JavaDoc) requestMap.get(PortletRequest.USER_INFO) ;
37     showBackButton_ = false ;
38     addActionListener(BackActionListener.class , BACK_ACTION) ;
39   }
40   
41   public boolean showBackButton() { return showBackButton_ ; }
42   
43   public Map JavaDoc getUserInfoMap() { return userInfoMap_ ; }
44   
45   public void setUserProfile(String JavaDoc userName) throws Exception JavaDoc {
46     userInfoMap_ = service_.findUserProfileByName(userName).getUserInfoMap() ;
47     showBackButton_ = true ;
48   }
49   
50   static public class BackActionListener extends ExoActionListener {
51     public void execute(ExoActionEvent event) throws Exception JavaDoc {
52       UIUserProfileSummary uiProfile = (UIUserProfileSummary) event.getComponent() ;
53       uiProfile.setRenderedSibling(UIListUser.class) ;
54     }
55   }
56 }
Popular Tags