Package javax.faces.component

Examples of javax.faces.component.UINamingContainer


        vdl.buildView(facesContext, root, "testSimpleAttributeActionMethodExpressionNoTarget.xhtml");

       
        UIComponent panelGroup1 = root.findComponent("testGroup1");
        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent);
        UICommand button = (UICommand) compositeComponent.findComponent("testComponentNoTarget");
        Assert.assertNotNull(button);
       
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        button.pushComponentToEL(facesContext,  button);
        MethodExpression method = button.getActionExpression();
        Assert.assertEquals(bean.doSomeAction(), method.invoke(facesContext.getELContext(), null));
        button.popComponentFromEL(facesContext);
        compositeComponent.popComponentFromEL(facesContext);

    }
View Full Code Here


        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root, "testCompositeAttributeActionMethodExpressionNoTarget.xhtml");

        UIComponent panelGroup1 = root.findComponent("testGroup1");
        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent);
       
        UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeActionMethodExpressionNoTarget");
        Assert.assertNotNull(compositeComponent3);
        UICommand testComponentNoTarget3 = (UICommand) compositeComponent3.findComponent("testComponentNoTarget");
        Assert.assertNotNull(testComponentNoTarget3);
        Assert.assertNotNull(testComponentNoTarget3.getActionExpression());
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        compositeComponent.pushComponentToEL(facesContext, compositeComponent3);
        Assert.assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
        compositeComponent3.popComponentFromEL(facesContext);
        compositeComponent.popComponentFromEL(facesContext);
    }
View Full Code Here

        vdl.buildView(facesContext, root, "testSimpleAttributeActionMethodExpressionTarget2.xhtml");

       
        UIComponent panelGroup1 = root.findComponent("testGroup1");
        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent);
        UICommand testComponent = (UICommand) compositeComponent.findComponent("testComponent");
        Assert.assertNotNull(testComponent);
        Assert.assertNotNull(testComponent.getActionExpression());
        Assert.assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
       
        UICommand testComponentNoTarget = (UICommand) compositeComponent.findComponent("testComponentNoTarget");
        Assert.assertNotNull(testComponentNoTarget);
        Assert.assertNotNull(testComponentNoTarget.getActionExpression());
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        Assert.assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
        compositeComponent.popComponentFromEL(facesContext);
    }
View Full Code Here

        vdl.buildView(facesContext, root, "testSimpleAttributeActionMethodExpressionTarget3.xhtml");

       
        UIComponent panelGroup1 = root.findComponent("testGroup1");
        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent);
        UICommand testComponent = (UICommand) compositeComponent.findComponent("testComponent");
        Assert.assertNotNull(testComponent);
        Assert.assertNotNull(testComponent.getActionExpression());
        Assert.assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));
       
        UICommand testComponentNoTarget = (UICommand) compositeComponent.findComponent("testComponentNoTarget");
        Assert.assertNotNull(testComponentNoTarget);
        Assert.assertNotNull(testComponentNoTarget.getActionExpression());
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        Assert.assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
        compositeComponent.popComponentFromEL(facesContext);
    }
View Full Code Here

        vdl.buildView(facesContext, root, "testCompositeAttributeActionMethodExpressionTarget2.xhtml");

       
        UIComponent panelGroup1 = root.findComponent("testGroup1");
        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent);
       
        UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionTarget");
        Assert.assertNotNull(compositeComponent2);
        UICommand testComponent = (UICommand) compositeComponent2.findComponent("testComponent");
        Assert.assertNotNull(testComponent);
        Assert.assertNotNull(testComponent.getActionExpression());
        Assert.assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));

        UICommand testComponentNoTarget = (UICommand) compositeComponent2.findComponent("testComponentNoTarget");
        Assert.assertNotNull(testComponentNoTarget);
        Assert.assertNotNull(testComponentNoTarget.getActionExpression());
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        Assert.assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
        compositeComponent.popComponentFromEL(facesContext);
       
        UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionNoTarget");
        Assert.assertNotNull(compositeComponent3);
        UICommand testComponent3 = (UICommand) compositeComponent3.findComponent("testComponent");
        Assert.assertNotNull(testComponent3);
        Assert.assertNotNull(testComponent3.getActionExpression());
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        compositeComponent3.pushComponentToEL(facesContext, compositeComponent3);
        Assert.assertEquals(bean.doSomeAction(), testComponent3.getActionExpression().invoke(facesContext.getELContext(), null));
        compositeComponent3.popComponentFromEL(facesContext);
        compositeComponent.popComponentFromEL(facesContext);
       
        UICommand testComponentNoTarget3 = (UICommand) compositeComponent3.findComponent("testComponentNoTarget");
        Assert.assertNotNull(testComponentNoTarget3);
        Assert.assertNotNull(testComponentNoTarget3.getActionExpression());
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        compositeComponent3.pushComponentToEL(facesContext, compositeComponent3);
        Assert.assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
        compositeComponent3.popComponentFromEL(facesContext);
        compositeComponent.popComponentFromEL(facesContext);
    }
View Full Code Here

        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root, "testCompositeAttributeActionMethodExpressionNoTarget2.xhtml");
       
        UIComponent panelGroup1 = root.findComponent("testGroup1");
        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent);
       
        UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("compositeAttributeMethodExpressionNoTarget");
        Assert.assertNotNull(compositeComponent2);
        UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent2.findComponent("simpleAttributeMethodExpressionNoTarget");
        Assert.assertNotNull(compositeComponent3);
        UICommand testComponentNoTarget3 = (UICommand) compositeComponent3.findComponent("testComponentNoTarget");
        Assert.assertNotNull(testComponentNoTarget3);
        Assert.assertNotNull(testComponentNoTarget3.getActionExpression());
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        compositeComponent.pushComponentToEL(facesContext, compositeComponent3);
        Assert.assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
        compositeComponent3.popComponentFromEL(facesContext);
        compositeComponent.popComponentFromEL(facesContext);
    }
View Full Code Here

        vdl.buildView(facesContext, root, "testCompositeAttributeActionMethodExpressionTarget3.xhtml");

       
        UIComponent panelGroup1 = root.findComponent("testGroup1");
        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent);
       
        UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionTarget");
        Assert.assertNotNull(compositeComponent2);
        UICommand testComponent = (UICommand) compositeComponent2.findComponent("testComponent");
        Assert.assertNotNull(testComponent);
        Assert.assertNotNull(testComponent.getActionExpression());
        Assert.assertEquals(bean.doSomeAction(), testComponent.getActionExpression().invoke(facesContext.getELContext(), null));

        UICommand testComponentNoTarget = (UICommand) compositeComponent2.findComponent("testComponentNoTarget");
        Assert.assertNotNull(testComponentNoTarget);
        Assert.assertNotNull(testComponentNoTarget.getActionExpression());
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
        Assert.assertEquals(bean.doSomeAction(), testComponentNoTarget.getActionExpression().invoke(facesContext.getELContext(), null));
        compositeComponent2.popComponentFromEL(facesContext);
        compositeComponent.popComponentFromEL(facesContext);
       
        UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent.findComponent("simpleAttributeMethodExpressionNoTarget");
        Assert.assertNotNull(compositeComponent3);
        UICommand testComponent3 = (UICommand) compositeComponent3.findComponent("testComponent");
        Assert.assertNotNull(testComponent3);
        Assert.assertNotNull(testComponent3.getActionExpression());
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        compositeComponent3.pushComponentToEL(facesContext, compositeComponent3);
        Assert.assertEquals(bean.doSomeAction(), testComponent3.getActionExpression().invoke(facesContext.getELContext(), null));
        compositeComponent3.popComponentFromEL(facesContext);
        compositeComponent.popComponentFromEL(facesContext);
       
        UICommand testComponentNoTarget3 = (UICommand) compositeComponent3.findComponent("testComponentNoTarget");
        Assert.assertNotNull(testComponentNoTarget3);
        Assert.assertNotNull(testComponentNoTarget3.getActionExpression());
        compositeComponent.pushComponentToEL(facesContext, compositeComponent);
        compositeComponent3.pushComponentToEL(facesContext, compositeComponent3);
        Assert.assertEquals(bean.doSomeAction(), testComponentNoTarget3.getActionExpression().invoke(facesContext.getELContext(), null));
        compositeComponent3.popComponentFromEL(facesContext);
        compositeComponent.popComponentFromEL(facesContext);
    }
View Full Code Here

        vdl.buildView(facesContext, root, "testConditionalButtonTargets.xhtml");

        //The first component has a default command button
        UIComponent form = root.findComponent("testForm1");
        Assert.assertNotNull(form);
        UINamingContainer compositeComponent1 = (UINamingContainer) form.findComponent("actionSource1");
        Assert.assertNotNull(compositeComponent1);
        UICommand button1 = (UICommand) compositeComponent1.findComponent("button");
        Assert.assertNotNull(button1);
        Assert.assertEquals("submit", button1.getActionExpression().invoke(facesContext.getELContext(), null));
       
        Assert.assertNotNull(button1.getActionListeners());
        Assert.assertEquals(1, button1.getActionListeners().length);
       
        UINamingContainer compositeComponent2 = (UINamingContainer) form.findComponent("actionSource2");
        Assert.assertNotNull(compositeComponent2);
        UICommand button2 = (UICommand) compositeComponent2.findComponent("button");
        Assert.assertNotNull(button2);
        //Since the button is outside cc:implementation, by the spec it cannot be taken into account as a valid "targets" value.
        Assert.assertEquals("fail", button2.getActionExpression().invoke(facesContext.getELContext(), null));
        //It also cannot be target of cc:actionSource
        Assert.assertNotNull(button2.getActionListeners());
View Full Code Here

        vdl.buildView(facesContext, root, "testSimpleAttributeValidatorTarget.xhtml");

       
        UIComponent panelGroup1 = root.findComponent("testGroup1");
        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent1);
        UIInput input1 = (UIInput) compositeComponent1.findComponent("testComponent");
        Assert.assertNotNull(input1);
        Assert.assertNotNull(input1.getValidators());
        Assert.assertEquals(1, input1.getValidators().length);
       
        bean.setValidator1Called(false);
View Full Code Here

        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root, "testCompositeAttributeValidatorTarget.xhtml");

        UIComponent panelGroup1 = root.findComponent("testGroup1");
        Assert.assertNotNull(panelGroup1);
        UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
        Assert.assertNotNull(compositeComponent1);
       
        UINamingContainer compositeComponent1inner = (UINamingContainer) compositeComponent1.findComponent("simpleAttributeMethodExpressionTarget");
        Assert.assertNotNull(compositeComponent1inner);
        UIInput input1 = (UIInput) compositeComponent1inner.findComponent("testComponent");
        Assert.assertNotNull(input1);
        Assert.assertNotNull(input1.getValidators());
        Assert.assertEquals(1, input1.getValidators().length);
       
        bean.setValidator1Called(false);
View Full Code Here

TOP

Related Classes of javax.faces.component.UINamingContainer

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.