Search in sources :

Example 1 with FormRendererPrimeFacesImpl

use of com.liferay.faces.bridge.renderkit.primefaces.internal.FormRendererPrimeFacesImpl in project liferay-faces-bridge-impl by liferay.

the class RenderKitBridgeImpl method getRenderer.

@Override
public Renderer getRenderer(String family, String rendererType) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext externalContext = facesContext.getExternalContext();
    ProductFactory productFactory = (ProductFactory) FactoryExtensionFinder.getFactory(externalContext, ProductFactory.class);
    final Product PRIMEFACES = productFactory.getProductInfo(Product.Name.PRIMEFACES);
    final boolean PRIMEFACES_DETECTED = PRIMEFACES.isDetected();
    Renderer renderer = super.getRenderer(family, rendererType);
    if (UIOutput.COMPONENT_FAMILY.equals(family)) {
        if (JAVAX_FACES_HEAD.equals(rendererType)) {
            final Product ICEFACES = productFactory.getProductInfo(Product.Name.ICEFACES);
            final boolean ICEFACES_DETECTED = ICEFACES.isDetected();
            if (ICEFACES_DETECTED) {
                renderer = new HeadRendererICEfacesImpl();
            } else if (PRIMEFACES_DETECTED) {
                renderer = new HeadRendererPrimeFacesImpl();
            } else {
                renderer = new HeadRendererBridgeImpl();
            }
        } else if (JAVAX_FACES_BODY.equals(rendererType)) {
            renderer = new BodyRendererBridgeImpl(renderer);
        } else if (RenderKitUtil.SCRIPT_RENDERER_TYPE.equals(rendererType) || RenderKitUtil.STYLESHEET_RENDERER_TYPE.equals(rendererType)) {
            renderer = new ResourceRendererBridgeImpl(renderer);
        }
    } else if (UIForm.COMPONENT_FAMILY.equals(family) && JAVAX_FACES_FORM.equals(rendererType) && PRIMEFACES_DETECTED) {
        renderer = new FormRendererPrimeFacesImpl(PRIMEFACES.getMajorVersion(), PRIMEFACES.getMinorVersion(), renderer);
    } else if (PRIMEFACES_FAMILY.equals(family) && PRIMEFACES_FILE_UPLOAD_RENDERER_TYPE.equals(rendererType)) {
        renderer = new FileUploadRendererPortletImpl(renderer);
    } else if (RICHFACES_FILE_UPLOAD_FAMILY.equals(family) && RICHFACES_FILE_UPLOAD_RENDERER_TYPE.equals(rendererType)) {
        renderer = new FileUploadRendererPortletImpl(new FileUploadRendererRichFacesImpl(renderer));
    }
    return renderer;
}
Also used : FacesContext(javax.faces.context.FacesContext) ProductFactory(com.liferay.faces.util.product.ProductFactory) FileUploadRendererPortletImpl(com.liferay.faces.bridge.renderkit.bridge.internal.FileUploadRendererPortletImpl) Product(com.liferay.faces.util.product.Product) FileUploadRendererRichFacesImpl(com.liferay.faces.bridge.renderkit.richfaces.internal.FileUploadRendererRichFacesImpl) HeadRendererICEfacesImpl(com.liferay.faces.bridge.renderkit.icefaces.internal.HeadRendererICEfacesImpl) FormRendererPrimeFacesImpl(com.liferay.faces.bridge.renderkit.primefaces.internal.FormRendererPrimeFacesImpl) ExternalContext(javax.faces.context.ExternalContext) Renderer(javax.faces.render.Renderer) HeadRendererPrimeFacesImpl(com.liferay.faces.bridge.renderkit.primefaces.internal.HeadRendererPrimeFacesImpl)

Aggregations

FileUploadRendererPortletImpl (com.liferay.faces.bridge.renderkit.bridge.internal.FileUploadRendererPortletImpl)1 HeadRendererICEfacesImpl (com.liferay.faces.bridge.renderkit.icefaces.internal.HeadRendererICEfacesImpl)1 FormRendererPrimeFacesImpl (com.liferay.faces.bridge.renderkit.primefaces.internal.FormRendererPrimeFacesImpl)1 HeadRendererPrimeFacesImpl (com.liferay.faces.bridge.renderkit.primefaces.internal.HeadRendererPrimeFacesImpl)1 FileUploadRendererRichFacesImpl (com.liferay.faces.bridge.renderkit.richfaces.internal.FileUploadRendererRichFacesImpl)1 Product (com.liferay.faces.util.product.Product)1 ProductFactory (com.liferay.faces.util.product.ProductFactory)1 ExternalContext (javax.faces.context.ExternalContext)1 FacesContext (javax.faces.context.FacesContext)1 Renderer (javax.faces.render.Renderer)1