1 5 package org.exoplatform.portlets.user.component; 6 7 import java.util.Map ; 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 21 public class UIUserProfileSummary extends UIExoCommand { 22 final static public String [] PERSONAL_INFO_KEYS = UIUserProfile.PERSONAL_INFO_KEYS ; 23 final static public String [] HOME_INFO_KEYS = UIUserProfile.HOME_INFO_KEYS ; 24 final static public String [] BUSINESE_INFO_KEYS = UIUserProfile.BUSINESE_INFO_KEYS ; 25 26 private Map userInfoMap_ ; 27 private boolean showBackButton_ ; 28 private OrganizationService service_ ; 29 30 public UIUserProfileSummary(OrganizationService service) throws Exception { 31 setId("UIUserProfile") ; 32 setRendererType("UserProfileRenderer") ; 33 service_ = service ; 34 ExternalContext eContext = FacesContext.getCurrentInstance().getExternalContext() ; 35 Map requestMap = eContext.getRequestMap() ; 36 userInfoMap_ = (Map ) 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 getUserInfoMap() { return userInfoMap_ ; } 44 45 public void setUserProfile(String userName) throws Exception { 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 { 52 UIUserProfileSummary uiProfile = (UIUserProfileSummary) event.getComponent() ; 53 uiProfile.setRenderedSibling(UIListUser.class) ; 54 } 55 } 56 } | Popular Tags |