Package javax.faces.application

Examples of javax.faces.application.ConfigurableNavigationHandler


        {
            throw new FacesException(
                    "Navigation handler must be an instance of "
                            + "ConfigurableNavigationHandler for using h:link or h:button");
        }
        ConfigurableNavigationHandler navigationHandler = (ConfigurableNavigationHandler) nh;
        // fromAction is null because there is no action method that was called to get the outcome
        NavigationCase navigationCase = navigationHandler.getNavigationCase(
                facesContext, null, outcome);
        // when navigation case is null, force the link or button to be disabled and log a warning
        if (navigationCase == null)
        {
            // log a warning
View Full Code Here


        NavigationHandler nh = facesContext.getApplication().getNavigationHandler();
        if (!(nh instanceof ConfigurableNavigationHandler)) {
            throw new FacesException("Navigation handler must be an instance of " +
                    "ConfigurableNavigationHandler for using h:link or h:button");
        }
        ConfigurableNavigationHandler navigationHandler = (ConfigurableNavigationHandler) nh;
        // fromAction is null because there is no action method that was called to get the outcome
        NavigationCase navigationCase = navigationHandler.getNavigationCase(facesContext, null, outcome);

        // when navigation case is null, force the "link" to be rendered as text
        if (navigationCase == null) {
            return null;
        }
View Full Code Here

        NavigationHandler nh = facesContext.getApplication().getNavigationHandler();
        if (!(nh instanceof ConfigurableNavigationHandler)) {
            throw new FacesException("Navigation handler must be an instance of " +
                    "ConfigurableNavigationHandler for using h:link or h:button");
        }
        ConfigurableNavigationHandler navigationHandler = (ConfigurableNavigationHandler) nh;
        // fromAction is null because there is no action method that was called to get the outcome
        NavigationCase navigationCase = navigationHandler.getNavigationCase(facesContext, null, outcome);

        // when navigation case is null, force the link or button to be disabled and log a warning
        if (navigationCase == null)
        {
            // log a warning
View Full Code Here

    public void testFlow1_1() throws Exception
    {
        setupRequest("/flow1_1.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        NavigationCase navCase = handler.getNavigationCase(facesContext, null, "flow1");
       
        Assert.assertNotNull(navCase);
       
        NavigationCase contentCase = handler.getNavigationCase(facesContext, null, "flow1_content");
       
        Assert.assertNull(contentCase);
       
        // Check begin view node
        Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
       
        processRender();
      
        //Enter flow 1
        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
       
        // Check Flow1Bean can be created
        Flow1Bean bean1 = facesContext.getApplication().evaluateExpressionGet(
            facesContext, "#{flow1Bean}", Flow1Bean.class);
        Assert.assertNotNull(bean1);
        Assert.assertEquals(bean1.getPostConstructCalled(), "true");
       
        contentCase = handler.getNavigationCase(facesContext, null, "flow1_content");
       
        Assert.assertNotNull(contentCase);
    }
View Full Code Here

    public void testFlow1_2() throws Exception
    {
        setupRequest("/flow1_2.xhtml");
        processLifecycleExecute();
       
        ConfigurableNavigationHandler handler = (ConfigurableNavigationHandler) facesContext.getApplication().getNavigationHandler();
       
        NavigationCase navCase = handler.getNavigationCase(facesContext, null, "flow1");
       
        Assert.assertNotNull(navCase);
       
        NavigationCase contentCase = handler.getNavigationCase(facesContext, null, "flow1_content");
       
        Assert.assertNull(contentCase);
       
        // Check begin view node
        Assert.assertEquals("/flow1/begin.xhtml", navCase.getToViewId(facesContext));
       
        processRender();
      
        //Enter flow 1
        UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:startFlow1");
        submit(button);
       
        processLifecycleExecute();
       
        Flow currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals("flow1", currentFlow.getId());
       
        facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow1","value1");
       
        // Check the bean with @FlowScoped annotation can be instantiated
        Flow1Bean bean1 = facesContext.getApplication().evaluateExpressionGet(
            facesContext, "#{flow1Bean}", Flow1Bean.class);
        Assert.assertNotNull(bean1);
        Assert.assertEquals(bean1.getPostConstructCalled(), "true");       
        bean1.setName("John");
       
        processRender();
       
        UICommand button2 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:call_flow2");
        submit(button2);
       
        processLifecycleExecute();
       
        currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals("flow2", currentFlow.getId());
        Assert.assertFalse(facesContext.getApplication().getFlowHandler().getCurrentFlowScope().containsKey("flow1"));
        facesContext.getApplication().getFlowHandler().getCurrentFlowScope().put("flow2","value2");
       
        Flow2Bean bean2 = facesContext.getApplication().evaluateExpressionGet(
            facesContext, "#{flow2Bean}", Flow2Bean.class);
        Assert.assertNotNull(bean2);
        Assert.assertEquals(bean2.getPostConstructCalled(), "true");
       
        Flow1Bean bean1_1 = facesContext.getApplication().evaluateExpressionGet(
            facesContext, "#{flow1Bean}", Flow1Bean.class);
        Assert.assertEquals(bean1_1.getName(), "John");
       
        Flow21Bean bean2_1 = facesContext.getApplication().evaluateExpressionGet(
            facesContext, "#{flow21Bean}", Flow21Bean.class);
        Assert.assertNotNull(bean2_1);
        Assert.assertEquals(bean2_1.getPostConstructCalled(), "true");
        Assert.assertNotNull(bean2_1.getFlow1Bean());

        processRender();
       
        //Check current view is the begin of flow2
        Assert.assertEquals("/flow2/begin.xhtml", facesContext.getViewRoot().getViewId());
       
        UICommand button3 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:content");
        submit(button3);
        processLifecycleExecute();
        processRender();
       
        currentFlow = facesContext.getApplication().getFlowHandler().getCurrentFlow(facesContext);
        Assert.assertNotNull(currentFlow);
        Assert.assertEquals("flow2", currentFlow.getId());

        NavigationCase endCase = handler.getNavigationCase(facesContext, null, "end");
        Assert.assertNotNull(endCase);
       
        UICommand button4 = (UICommand) facesContext.getViewRoot().findComponent("mainForm:end_flow");
        submit(button4);
       
View Full Code Here

        {
            throw new FacesException(
                    "Navigation handler must be an instance of "
                            + "ConfigurableNavigationHandler for using h:link or h:button");
        }
        ConfigurableNavigationHandler navigationHandler = (ConfigurableNavigationHandler) nh;
        // fromAction is null because there is no action method that was called to get the outcome
        NavigationCase navigationCase = navigationHandler.getNavigationCase(
                facesContext, null, outcome);
        // when navigation case is null, force the link or button to be disabled and log a warning
        if (navigationCase == null)
        {
            // log a warning
View Full Code Here

import org.primefaces.context.RequestContext;

public class OutcomeTargetRenderer extends CoreRenderer {
   
    protected NavigationCase findNavigationCase(FacesContext context, UIOutcomeTarget outcomeTarget) {
        ConfigurableNavigationHandler navHandler = (ConfigurableNavigationHandler) context.getApplication().getNavigationHandler();
        String outcome = outcomeTarget.getOutcome();
       
        if (outcome == null) {
            outcome = context.getViewRoot().getViewId();
        }
       
        return navHandler.getNavigationCase(context, null, outcome);
    }
View Full Code Here

        }
      }
    }

    public static NavigationCase findNavigationCase(FacesContext context, String outcome) {
        ConfigurableNavigationHandler navHandler = (ConfigurableNavigationHandler) context.getApplication().getNavigationHandler();
        String outcomeValue = (outcome == null) ? context.getViewRoot().getViewId() : outcome;

        return navHandler.getNavigationCase(context, null, outcomeValue);
    }
View Full Code Here

        NavigationHandler nh = facesContext.getApplication().getNavigationHandler();
        if (!(nh instanceof ConfigurableNavigationHandler)) {
            throw new FacesException("Navigation handler must be an instance of " +
                    "ConfigurableNavigationHandler for using h:link or h:button");
        }
        ConfigurableNavigationHandler navigationHandler = (ConfigurableNavigationHandler) nh;
        // fromAction is null because there is no action method that was called to get the outcome
        NavigationCase navigationCase = navigationHandler.getNavigationCase(facesContext, null, outcome);

        // when navigation case is null, force the link or button to be disabled and log a warning
        if (navigationCase == null)
        {
            // log a warning
View Full Code Here

        NavigationHandler nh = facesContext.getApplication().getNavigationHandler();
        if (!(nh instanceof ConfigurableNavigationHandler)) {
            throw new FacesException("Navigation handler must be an instance of " +
                    "ConfigurableNavigationHandler for using h:link or h:button");
        }
        ConfigurableNavigationHandler navigationHandler = (ConfigurableNavigationHandler) nh;
        // fromAction is null because there is no action method that was called to get the outcome
        NavigationCase navigationCase = navigationHandler.getNavigationCase(facesContext, null, outcome);

        // when navigation case is null, force the link or button to be disabled and log a warning
        if (navigationCase == null)
        {
            // log a warning
View Full Code Here

TOP

Related Classes of javax.faces.application.ConfigurableNavigationHandler

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.