KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > test > mocks > portlet > MockPortletFacesContext


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.test.mocks.portlet;
6
7 import javax.portlet.* ;
8 import javax.faces.context.FacesContext ;
9 import org.exoplatform.test.mocks.jsf.*;
10
11 /**
12  * Apr 25, 2004
13  * @author: Tuan Nguyen
14  * @email: tuan08@users.sourceforge.net
15  * @version: $Id: MockPortletFacesContext.java,v 1.1 2004/10/11 23:27:26 tuan08 Exp $
16  **/

17 public class MockPortletFacesContext extends MockFacesContext {
18     
19     
20     public MockPortletFacesContext() {
21      externalContext_ = new MockPortletExternalContext();
22   }
23   
24   public PortletPreferences getPortletPreferences() {
25     return ((MockPortletExternalContext) externalContext_).getPortletPreferences() ;
26   }
27   
28   public MockPortletConfig getMockPortletConfig() {
29     return ((MockPortletExternalContext) externalContext_).getMockPortletConfig() ;
30   }
31   
32   public MockPortletContext getMockPortletContext() {
33     return ((MockPortletExternalContext) externalContext_).getMockPortletContext() ;
34   }
35   
36   public static MockPortletFacesContext getMockPortletFacesContextCurrentInstance() {
37     MockPortletFacesContext context = (MockPortletFacesContext)FacesContext.getCurrentInstance() ;
38     if(context == null) {
39       context= new MockPortletFacesContext() ;
40       FacesContext.setCurrentInstance(context) ;
41     }
42     return context ;
43   }
44 }
45
Popular Tags