Package org.apache.myfaces.view.facelets.tag

Examples of org.apache.myfaces.view.facelets.tag.ComponentTagDeclarationLibrary$UserComponentHandlerFactory


       
        RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(eContext);
        if (!runtimeConfig.getComponentTagDeclarations().isEmpty())
        {
            // Set a dummy view root, to avoid Application.createComponent() to fail
            ComponentTagDeclarationLibrary componentTagDeclarationLibrary = new ComponentTagDeclarationLibrary();
           
            LoadComponentTagDeclarationFacesContextWrapper wrappedFacesContext =
                new LoadComponentTagDeclarationFacesContextWrapper(context);
            try
            {
                wrappedFacesContext.setWrapperAsCurrentFacesContext();
                UIViewRoot root = new UIViewRoot();
                root.setRenderKitId("HTML_BASIC");
                wrappedFacesContext.setViewRoot(new UIViewRoot());
               
                for (ComponentTagDeclaration declaration : runtimeConfig.getComponentTagDeclarations())
                {
                    // We have here probably an inconsistency, because the annotation does not
                    // have a default renderer type. Let the renderer type be null will cause problems
                    // later, because application.createComponent() may not scan the renderer class if
                    // a rendererType is not provided. The easy way to overcome this situation is create
                    // a dummy instance and check its rendererType. If is set the renderer if any will be
                    // scanned for annotations, if not it just do things as usual. It is unlikely to create
                    // a component and does not set a default renderer type if is required.
                    UIComponent component = context.getApplication().createComponent(declaration.getComponentType());
                    componentTagDeclarationLibrary.addComponent(declaration.getNamespace(),
                            declaration.getTagName(), declaration.getComponentType(), component.getRendererType());
                }
            }
            finally
            {
View Full Code Here


        compiler.addTagLibrary(new PassThroughLibrary());
       
        RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(eContext);
        if (!runtimeConfig.getComponentTagDeclarations().isEmpty())
        {
            ComponentTagDeclarationLibrary componentTagDeclarationLibrary = new ComponentTagDeclarationLibrary();
            for (ComponentTagDeclaration declaration : runtimeConfig.getComponentTagDeclarations())
            {
                // We have here probably an inconsistency, because the annotation does not
                // have a default renderer type. Let the renderer type be null will cause problems
                // later, because application.createComponent() may not scan the renderer class if
                // a rendererType is not provided. The easy way to overcome this situation is create
                // a dummy instance and check its rendererType. If is set the renderer if any will be
                // scanned for annotations, if not it just do things as usual. It is unlikely to create
                // a component and does not set a default renderer type if is required.
                UIComponent component = context.getApplication().createComponent(declaration.getComponentType());
                componentTagDeclarationLibrary.addComponent(declaration.getNamespace(),
                        declaration.getTagName(), declaration.getComponentType(), component.getRendererType());
            }
            compiler.addTagLibrary(componentTagDeclarationLibrary);
        }
       
View Full Code Here

TOP

Related Classes of org.apache.myfaces.view.facelets.tag.ComponentTagDeclarationLibrary$UserComponentHandlerFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.