Package java.beans

Examples of java.beans.BeanDescriptor


        //Apply all facelets not applied yet.
       
        CompositeComponentBeanInfo beanInfo =
            (CompositeComponentBeanInfo) c.getAttributes().get(UIComponent.BEANINFO_KEY);
       
        BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();

        boolean insertChildrenUsed = (beanDescriptor.getValue(InsertChildrenHandler.INSERT_CHILDREN_USED) != null);
       
        List<String> insertFacetList = (List<String>) beanDescriptor.getValue(InsertFacetHandler.INSERT_FACET_USED);
       
        if (nextHandler instanceof javax.faces.view.facelets.CompositeFaceletHandler)
        {
            for (FaceletHandler handler :
                    ((javax.faces.view.facelets.CompositeFaceletHandler)nextHandler).getHandlers())
            {
                if (handler instanceof javax.faces.view.facelets.FacetHandler)
                {
                    if (insertFacetList == null ||
                        !insertFacetList.contains(((javax.faces.view.facelets.FacetHandler)handler).getFacetName(ctx)))
                    {
                        handler.apply(ctx, c);
                    }
                }
                else if (handler instanceof InsertFacetHandler)
                {
                    if (insertFacetList == null ||
                        !insertFacetList.contains( ((InsertFacetHandler)handler).getFacetName(ctx)))
                    {
                        handler.apply(ctx, c);
                    }
                }
                else if (insertChildrenUsed)
                {
                    if (!(handler instanceof javax.faces.view.facelets.ComponentHandler ||
                            handler instanceof InsertChildrenHandler ||
                            handler instanceof InsertHandler ||
                            handler instanceof DecorateHandler ||
                            handler instanceof IncludeHandler ||
                            handler instanceof TextHandler))
                    {
                        handler.apply(ctx, c);
                    }
                }
                else
                {
                    handler.apply(ctx, c);
                }
            }
        }
        else
        {
            if (nextHandler instanceof javax.faces.view.facelets.FacetHandler)
            {
                if (insertFacetList == null ||
                    !insertFacetList.contains(((javax.faces.view.facelets.FacetHandler)nextHandler).getFacetName(ctx)))
                {
                    nextHandler.apply(ctx, c);
                }
            }
            else if (nextHandler instanceof InsertFacetHandler)
            {
                if (insertFacetList == null ||
                    !insertFacetList.contains( ((InsertFacetHandler)nextHandler).getFacetName(ctx)) )
                {
                    nextHandler.apply(ctx, c);
                }
            }
            else if (insertChildrenUsed)
            {
                if (!(nextHandler instanceof javax.faces.view.facelets.ComponentHandler ||
                        nextHandler instanceof InsertChildrenHandler ||
                        nextHandler instanceof InsertHandler ||
                        nextHandler instanceof DecorateHandler ||
                        nextHandler instanceof IncludeHandler ||
                        nextHandler instanceof TextHandler))
                {
                    nextHandler.apply(ctx, c);
                }
            }
            else
            {
                nextHandler.apply(ctx, c);
            }
        }
       
        //Check for required facets
        Map<String, PropertyDescriptor> facetPropertyDescriptorMap = (Map<String, PropertyDescriptor>)
            beanDescriptor.getValue(UIComponent.FACETS_KEY);
       
        if (facetPropertyDescriptorMap != null)
        {
            List<String> facetsRequiredNotFound = null;
            for (Map.Entry<String, PropertyDescriptor> entry : facetPropertyDescriptorMap.entrySet())
View Full Code Here


       
        CompositeComponentBeanInfo beanInfo =
            (CompositeComponentBeanInfo) innerCompositeComponent.getAttributes()
            .get(UIComponent.BEANINFO_KEY);
       
        BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();
       
        Map<String, PropertyDescriptor> insertFacetPropertyDescriptorMap = (Map<String, PropertyDescriptor>)
            beanDescriptor.getValue(InsertFacetHandler.INSERT_FACET_KEYS);

        if (insertFacetPropertyDescriptorMap != null && insertFacetPropertyDescriptorMap.containsKey(name))
        {
            ValueExpression requiredExpr
                    = (ValueExpression) insertFacetPropertyDescriptorMap.get(name).getValue("required");
View Full Code Here

    }
   
    private CompositeComponentBeanInfo _createCompositeComponentMetadata(
            FaceletContext ctx, UIComponent parent)
    {
        BeanDescriptor descriptor = new BeanDescriptor(parent.getClass());
        CompositeComponentBeanInfo beanInfo = new CompositeComponentBeanInfo(descriptor);
        return beanInfo;
    }
View Full Code Here

        try {
            Introspector
                    .setBeanInfoSearchPath(new String[] { "java.beans.infos" });
            BeanInfo info = Introspector.getBeanInfo(SampleBean.class);
            assertNotNull(info);
            BeanDescriptor descriptor = info.getBeanDescriptor();
            assertNotNull(descriptor);
            assertEquals(SampleBean.class, descriptor.getBeanClass());
        } finally {
            Introspector.setBeanInfoSearchPath(oldBeanInfoSearchPath);
        }
    }
View Full Code Here

        assertEquals("a1", Introspector.decapitalize("A1"));
    }

    public void testFlushCaches() throws IntrospectionException {
        BeanInfo info = Introspector.getBeanInfo(MockJavaBean.class);
        BeanDescriptor beanDesc = new BeanDescriptor(MockJavaBean.class);
        assertEquals(beanDesc.getName(), info.getBeanDescriptor().getName());
        assertEquals(beanDesc.isExpert(), info.getBeanDescriptor().isExpert());

        Introspector.flushCaches();
        BeanInfo cacheInfo = Introspector.getBeanInfo(MockJavaBean.class);
        assertNotSame(info, cacheInfo);
        beanDesc = new BeanDescriptor(MockJavaBean.class);
        assertEquals(beanDesc.getName(), info.getBeanDescriptor().getName());
        assertEquals(beanDesc.isExpert(), info.getBeanDescriptor().isExpert());
    }
View Full Code Here

        assertNotSame(info, info3);
    }

    public void testFlushFromCaches_Null() throws IntrospectionException {
        BeanInfo info = Introspector.getBeanInfo(MockJavaBean.class);
        BeanDescriptor beanDesc = new BeanDescriptor(MockJavaBean.class);
        assertEquals(beanDesc.getName(), info.getBeanDescriptor().getName());
        assertEquals(beanDesc.isExpert(), info.getBeanDescriptor().isExpert());
        try {
            Introspector.flushFromCaches(null);
            fail("Should throw NullPointerException.");
        } catch (NullPointerException e) {
        }
View Full Code Here

    public void testGetBeanInfoClass_no_BeanInfo()
            throws IntrospectionException {
        Class<FakeFox> beanClass = FakeFox.class;
        BeanInfo info = Introspector.getBeanInfo(beanClass);
        assertNull(info.getAdditionalBeanInfo());
        BeanDescriptor beanDesc = info.getBeanDescriptor();
        assertEquals("FakeFox", beanDesc.getName());
        assertEquals(0, info.getEventSetDescriptors().length);
        assertEquals(-1, info.getDefaultEventIndex());
        assertEquals(-1, info.getDefaultPropertyIndex());

        MethodDescriptor[] methodDesc = info.getMethodDescriptors();
View Full Code Here

    public void testGetBeanInfoSearchPath_Default()
            throws IntrospectionException, ClassNotFoundException {
        BeanInfo info = Introspector.getBeanInfo(MockFooButton.class);
        PropertyDescriptor[] pds = info.getPropertyDescriptors();
        BeanDescriptor beanDesc;

        assertEquals(2, pds.length);
        assertEquals("class", pds[0].getName());

        beanDesc = info.getBeanDescriptor();
        assertEquals("MockFooButton", beanDesc.getName());
    }
View Full Code Here

     */
    public void testBeanInfo_1() throws IntrospectionException {
        Class<FakeFox011> beanClass = FakeFox011.class;
        BeanInfo info = Introspector.getBeanInfo(beanClass);
        assertNull(info.getAdditionalBeanInfo());
        BeanDescriptor beanDesc = info.getBeanDescriptor();
        assertEquals("FakeFox011", beanDesc.getName());
        assertEquals(0, info.getEventSetDescriptors().length);
        assertEquals(-1, info.getDefaultEventIndex());
        assertEquals(0, info.getDefaultPropertyIndex());

        MethodDescriptor[] methodDesc = info.getMethodDescriptors();
View Full Code Here

    public void testBeanInfo_2() throws IntrospectionException {
        Class<FakeFox02> beanClass = FakeFox02.class;
        BeanInfo info = Introspector.getBeanInfo(beanClass);
        assertNull(info.getAdditionalBeanInfo());
        BeanDescriptor beanDesc = info.getBeanDescriptor();
        assertEquals("FakeFox02", beanDesc.getName());
        assertEquals(0, info.getEventSetDescriptors().length);
        assertEquals(-1, info.getDefaultEventIndex());
        assertEquals(-1, info.getDefaultPropertyIndex());

        MethodDescriptor[] methodDesc = info.getMethodDescriptors();
View Full Code Here

TOP

Related Classes of java.beans.BeanDescriptor

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.