Package javax.faces.component

Examples of javax.faces.component.UICommand


      LOG.error("No actionListener found in tree, so tree editing will not work!");
    }

    UITreeOld.Command[] commands = getCommands();
    for (int i = 0; i < commands.length; i++) {
      UICommand command = (UICommand) ComponentUtil.createComponent(
          facesContext, UICommand.COMPONENT_TYPE,
          TobagoConstants.RENDERER_TYPE_LINK, commands[i].getCommand());
      toolbar.getChildren().add(command);

      for (ActionListener listener : getActionListeners()) {
        command.addActionListener(listener);
      }
      command.setActionListener(getActionListener());
      command.getAttributes().put(
          TobagoConstants.ATTR_IMAGE, "image/tobago.tree." + commands[i].getCommand() + ".gif");
      String title = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago",
          "tree" + StringUtils.firstToUpperCase(commands[i].getCommand()));
      command.getAttributes().put(TobagoConstants.ATTR_TIP, title);

    }

    getFacets().put("defaultToolbar", toolbar);
View Full Code Here


        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root,"testActionException1.xhtml");
       
        request.addParameter("mainForm:button1", "Submit");

        UICommand button = (UICommand) root.findComponent("mainForm:button1");
        Assert.assertNotNull(button);
       
        ExceptionBean bean = EasyMock.createMock(ExceptionBean.class);
        EasyMock.expect(bean.doSomeAction()).andThrow(new AbortProcessingException());
        // Setup is finished need to activate the mock
        EasyMock.replay(bean);
               
        request.setAttribute("bean", bean);
               
        button.processDecodes(facesContext);
       
        try
        {
            root.processApplication(facesContext);
        }
View Full Code Here

        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root,"testActionException1.xhtml");
       
        request.addParameter("mainForm:button1", "Submit");

        UICommand button = (UICommand) root.findComponent("mainForm:button1");
        Assert.assertNotNull(button);
       
        ExceptionBean bean = EasyMock.createMock(ExceptionBean.class);
        EasyMock.expect(bean.doSomeAction()).andThrow(new RuntimeException());
        // Setup is finished need to activate the mock
        EasyMock.replay(bean);
               
        request.setAttribute("bean", bean);
               
        button.processDecodes(facesContext);
       
        try
        {
            root.processApplication(facesContext);
        }
View Full Code Here

        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root,"testActionException1.xhtml");
       
        request.addParameter("mainForm:button1", "Submit");

        UICommand button = (UICommand) root.findComponent("mainForm:button1");
        Assert.assertNotNull(button);
       
        ExceptionBean bean = EasyMock.createMock(ExceptionBean.class);
        EasyMock.expect(bean.doSomeAction()).andThrow(new IOException());
        // Setup is finished need to activate the mock
        EasyMock.replay(bean);
               
        request.setAttribute("bean", bean);
               
        button.processDecodes(facesContext);
       
        try
        {
            root.processApplication(facesContext);
        }
View Full Code Here

        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root,"testActionListenerException1.xhtml");
       
        request.addParameter("mainForm:button1", "Submit");

        UICommand button = (UICommand) root.findComponent("mainForm:button1");
        Assert.assertNotNull(button);
       
        //ActionEvent event = new ActionEvent(button);
        ExceptionBean bean = EasyMock.createMock(ExceptionBean.class);
        bean.doSomeActionListener((ActionEvent)EasyMock.anyObject());
        EasyMock.expectLastCall().andThrow(new AbortProcessingException());
        // Setup is finished need to activate the mock
        EasyMock.replay(bean);
               
        request.setAttribute("bean", bean);
               
        button.processDecodes(facesContext);
       
        try
        {
            root.processApplication(facesContext);
        }
View Full Code Here

        UIViewRoot root = facesContext.getViewRoot();
        vdl.buildView(facesContext, root,"testActionListenerException1.xhtml");
       
        request.addParameter("mainForm:button1", "Submit");

        UICommand button = (UICommand) root.findComponent("mainForm:button1");
        Assert.assertNotNull(button);
       
        //ActionEvent event = new ActionEvent(button);
        ExceptionBean bean = EasyMock.createMock(ExceptionBean.class);
        bean.doSomeActionListener((ActionEvent)EasyMock.anyObject());
        EasyMock.expectLastCall().andThrow(new RuntimeException());
        // Setup is finished need to activate the mock
        EasyMock.replay(bean);
               
        request.setAttribute("bean", bean);
               
        button.processDecodes(facesContext);
       
        try
        {
            root.processApplication(facesContext);
        }
View Full Code Here

           
            UIComponent header = collapsiblePanel.getFacet("header");
           
            if (header != null)
            {
                UICommand link = (UICommand)RendererUtils.findComponent(header,HtmlHeaderLink.class);
               
                if (link != null && link.isImmediate())
                {
                    //In this case we need to update the model directly, because
                    //PROCESS_VALIDATIONS and UPDATE_MODEL phase is not called
                    //(immediate=true), but we need to reflect the change
                    //on the collapsed value.
View Full Code Here

        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

       
        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

        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

TOP

Related Classes of javax.faces.component.UICommand

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.