View Javadoc

1   /*
2    * $Id: AbstractAsyncRenderService.java,v 1.18 2011/06/16 09:29:41 jbmeslin Exp $
3    */
4   package org.rcfaces.core.internal.service;
5   
6   import javax.faces.component.UIComponent;
7   import javax.faces.context.FacesContext;
8   import javax.faces.render.RenderKitFactory;
9   import javax.servlet.jsp.tagext.BodyContent;
10  
11  import org.rcfaces.core.internal.Constants;
12  import org.rcfaces.core.internal.RcfacesContext;
13  
14  /**
15   * 
16   * @author Olivier Oeuillot (latest modification by $Author: jbmeslin $)
17   * @version $Revision: 1.18 $ $Date: 2011/06/16 09:29:41 $
18   */
19  public abstract class AbstractAsyncRenderService implements IService {
20      private static final String REVISION = "$Revision: 1.18 $";
21  
22      private static final String SERVICE_ID = Constants.getPackagePrefix()
23              + ".AsyncRender";
24  
25      public static final int DEFAULT_ASYNC_RENDER_BUFFER_MODE = 0;
26  
27      public static final int IGNORE_ASYNC_RENDER_BUFFER_MODE = 1;
28  
29      public static final int BUFFER_ASYNC_RENDER_BUFFER_MODE = 2;
30  
31      public static AbstractAsyncRenderService getInstance(
32              FacesContext facesContext) {
33  
34          IServicesRegistry serviceRegistry = RcfacesContext.getInstance(
35                  facesContext).getServicesRegistry();
36          if (serviceRegistry == null) {
37              // Designer mode
38              return null;
39          }
40  
41          return (AbstractAsyncRenderService) serviceRegistry.getService(
42                  facesContext, RenderKitFactory.HTML_BASIC_RENDER_KIT,
43                  SERVICE_ID);
44      }
45  
46      public abstract boolean isAsyncRenderEnable();
47  
48      public abstract int getAsyncRendererBufferMode(FacesContext facesContext,
49              UIComponent component);
50  
51      public abstract void setContent(FacesContext facesContext,
52              UIComponent componentInstance, BodyContent bodyContent);
53  }