Examples of IDirect


Examples of org.apache.tapestry.IDirect

    {
        IPage page = newPage("ThePage");
        WebRequest request = newWebRequest(false, newWebSession());

        MockControl cc = newControl(IDirect.class);
        IDirect c = (IDirect) cc.getMock();

        MockControl cyclec = newControl(IRequestCycle.class);
        IRequestCycle cycle = (IRequestCycle) cyclec.getMock();

        cycle.getPage();
        cyclec.setReturnValue(page);

        c.getPage();
        cc.setReturnValue(page);

        c.getIdPath();
        cc.setReturnValue("fred.barney");

        Object[] serviceParameters = new Object[0];

        Map parameters = new HashMap();
View Full Code Here

Examples of org.apache.tapestry.IDirect

    {
        IPage page = newPage("ActivePage");
        IPage componentPage = newPage("ComponentPage");
        WebRequest request = newWebRequest(false, null);
        MockControl cc = newControl(IDirect.class);
        IDirect c = (IDirect) cc.getMock();

        MockControl cyclec = newControl(IRequestCycle.class);
        IRequestCycle cycle = (IRequestCycle) cyclec.getMock();

        cycle.getPage();
        cyclec.setReturnValue(page);

        c.getPage();
        cc.setReturnValue(componentPage);

        c.getIdPath();
        cc.setReturnValue("fred.barney");

        Object[] serviceParameters = new Object[0];

        Map parameters = new HashMap();
View Full Code Here

Examples of org.apache.tapestry.IDirect

        cyclec.setReturnValue(page);

        cycle.activate(page);

        MockControl dc = newControl(IDirect.class);
        IDirect d = (IDirect) dc.getMock();

        page.getNestedComponent("fred.barney");
        pagec.setReturnValue(d);

        MockControl lfc = newControl(LinkFactory.class);
        LinkFactory lf = (LinkFactory) lfc.getMock();

        lf.extractListenerParameters(cycle);
        lfc.setReturnValue(parameters);

        cycle.setListenerParameters(parameters);

        d.trigger(cycle);

        ResponseRenderer rr = newResponseRenderer();

        rr.renderResponse(cycle);
View Full Code Here

Examples of org.apache.tapestry.IDirect

        cycle.getPage("ComponentPage");
        cyclec.setReturnValue(componentPage);

        MockControl dc = newControl(IDirect.class);
        IDirect d = (IDirect) dc.getMock();

        componentPage.getNestedComponent("fred.barney");
        componentPagec.setReturnValue(d);

        MockControl lfc = newControl(LinkFactory.class);
        LinkFactory lf = (LinkFactory) lfc.getMock();

        lf.extractListenerParameters(cycle);
        lfc.setReturnValue(parameters);

        cycle.setListenerParameters(parameters);

        d.trigger(cycle);

        ResponseRenderer rr = newResponseRenderer();

        rr.renderResponse(cycle);
View Full Code Here

Examples of org.apache.tapestry.IDirect

        cyclec.setReturnValue(page);

        cycle.activate(page);

        MockControl dc = newControl(IDirect.class);
        IDirect d = (IDirect) dc.getMock();

        page.getNestedComponent("fred.barney");
        pagec.setReturnValue(d);

        d.isStateful();
        dc.setReturnValue(true);

        WebSession session = newWebSession(false);
        WebRequest request = newWebRequest(session);

        MockControl lfc = newControl(LinkFactory.class);
        LinkFactory lf = (LinkFactory) lfc.getMock();

        lf.extractListenerParameters(cycle);
        lfc.setReturnValue(parameters);

        cycle.setListenerParameters(parameters);

        d.trigger(cycle);

        ResponseRenderer rr = newResponseRenderer();

        rr.renderResponse(cycle);
View Full Code Here

Examples of org.apache.tapestry.IDirect

        cyclec.setReturnValue(page);

        cycle.activate(page);

        MockControl dc = newControl(IDirect.class);
        IDirect d = (IDirect) dc.getMock();

        page.getNestedComponent("fred.barney");
        pagec.setReturnValue(d);

        d.isStateful();
        dc.setReturnValue(true);

        WebRequest request = newWebRequest(null);

        d.getExtendedId();
        dc.setReturnValue("ActivePage/fred.barney");

        page.getLocation();
        pagec.setReturnValue(l);
View Full Code Here

Examples of org.apache.tapestry.IDirect

    } finally { }}

    public void service(IEngineServiceView engine, IRequestCycle cycle, ResponseOutputStream output)
            throws ServletException, IOException
    {try { __CLOVER_80_0.M[3032]++;
        __CLOVER_80_0.S[12480]++;IDirect direct;
        __CLOVER_80_0.S[12481]++;int count = 0;
        __CLOVER_80_0.S[12482]++;String componentPageName;
        __CLOVER_80_0.S[12483]++;IPage componentPage;
        __CLOVER_80_0.S[12484]++;RequestContext requestContext = cycle.getRequestContext();
        __CLOVER_80_0.S[12485]++;String[] serviceContext = getServiceContext(requestContext);

        __CLOVER_80_0.S[12486]++;if ((((serviceContext != null) && (++__CLOVER_80_0.CT[2139] != 0)) || (++__CLOVER_80_0.CF[2139] == 0))){
            __CLOVER_80_0.S[12487]++;count = serviceContext.length;}

        __CLOVER_80_0.S[12488]++;if ((((count != 3 && count != 4) && (++__CLOVER_80_0.CT[2140] != 0)) || (++__CLOVER_80_0.CF[2140] == 0))){
            __CLOVER_80_0.S[12489]++;throw new ApplicationRuntimeException(Tapestry
                    .getMessage("DirectService.context-parameters"));}

        __CLOVER_80_0.S[12490]++;boolean complex = count == 4;

        __CLOVER_80_0.S[12491]++;int i = 0;
        __CLOVER_80_0.S[12492]++;String stateful = serviceContext[i++];
        __CLOVER_80_0.S[12493]++;String pageName = serviceContext[i++];

        __CLOVER_80_0.S[12494]++;if ((((complex) && (++__CLOVER_80_0.CT[2141] != 0)) || (++__CLOVER_80_0.CF[2141] == 0))){
            __CLOVER_80_0.S[12495]++;componentPageName = serviceContext[i++];}
        else{
            __CLOVER_80_0.S[12496]++;componentPageName = pageName;}

        __CLOVER_80_0.S[12497]++;String componentPath = serviceContext[i++];

        __CLOVER_80_0.S[12498]++;IPage page = cycle.getPage(pageName);

        __CLOVER_80_0.S[12499]++;cycle.activate(page);

        __CLOVER_80_0.S[12500]++;if ((((complex) && (++__CLOVER_80_0.CT[2142] != 0)) || (++__CLOVER_80_0.CF[2142] == 0))){
            __CLOVER_80_0.S[12501]++;componentPage = cycle.getPage(componentPageName);}
        else{
            __CLOVER_80_0.S[12502]++;componentPage = page;}

        __CLOVER_80_0.S[12503]++;IComponent component = componentPage.getNestedComponent(componentPath);

        __CLOVER_80_0.S[12504]++;try
        {
            __CLOVER_80_0.S[12505]++;direct = (IDirect) component;
        }
        catch (ClassCastException ex)
        {
            __CLOVER_80_0.S[12506]++;throw new ApplicationRuntimeException(Tapestry.format(
                    "DirectService.component-wrong-type",
                    component.getExtendedId()), component, null, ex);
        }

        // Check for a StateSession only the session was stateful when
        // the Gesture was created.

        __CLOVER_80_0.S[12507]++;if ((((stateful.equals(STATEFUL_ON) && direct.isStateful()) && (++__CLOVER_80_0.CT[2143] != 0)) || (++__CLOVER_80_0.CF[2143] == 0))){
        {
            __CLOVER_80_0.S[12508]++;HttpSession session = cycle.getRequestContext().getSession();

            __CLOVER_80_0.S[12509]++;if ((((session == null || session.isNew()) && (++__CLOVER_80_0.CT[2144] != 0)) || (++__CLOVER_80_0.CF[2144] == 0))){
                __CLOVER_80_0.S[12510]++;throw new StaleSessionException(Tapestry.format(
                        "DirectService.stale-session-exception",
                        direct.getExtendedId()), direct.getPage());}
        }}

        __CLOVER_80_0.S[12511]++;Object[] parameters = getParameters(cycle);

        __CLOVER_80_0.S[12512]++;cycle.setServiceParameters(parameters);
        __CLOVER_80_0.S[12513]++;direct.trigger(cycle);

        // Render the response. This will be the response page (the first element in the context)
        // unless the direct (or its delegate) changes it.

        __CLOVER_80_0.S[12514]++;_responseRenderer.renderResponse(cycle, output);
View Full Code Here

Examples of org.apache.tapestry.IDirect

    }

    public void service(IEngineServiceView engine, IRequestCycle cycle, ResponseOutputStream output)
        throws ServletException, IOException
    {
        IDirect direct;
        int count = 0;
        String componentPageName;
        IPage componentPage;
        RequestContext requestContext = cycle.getRequestContext();
        String[] serviceContext = getServiceContext(requestContext);

        if (serviceContext != null)
            count = serviceContext.length;

        if (count != 3 && count != 4)
            throw new ApplicationRuntimeException(Tapestry.getMessage("DirectService.context-parameters"));

        boolean complex = count == 4;

        int i = 0;
        String stateful = serviceContext[i++];
        String pageName = serviceContext[i++];

        if (complex)
            componentPageName = serviceContext[i++];
        else
            componentPageName = pageName;

        String componentPath = serviceContext[i++];

        IPage page = cycle.getPage(pageName);

        cycle.activate(page);

        if (complex)
            componentPage = cycle.getPage(componentPageName);
        else
            componentPage = page;

        IComponent component = componentPage.getNestedComponent(componentPath);

        try
        {
            direct = (IDirect) component;
        }
        catch (ClassCastException ex)
        {
            throw new ApplicationRuntimeException(
                Tapestry.format("DirectService.component-wrong-type", component.getExtendedId()),
                component,
                ex);
        }

        // Check for a StateSession only the session was stateful when
        // the Gesture was created.

        if (stateful.equals(STATEFUL_ON) && direct.isStateful())
        {
            HttpSession session = cycle.getRequestContext().getSession();

            if (session == null || session.isNew())
                throw new StaleSessionException(
                    Tapestry.format("DirectService.stale-session-exception", direct.getExtendedId()),
                    direct.getPage());
        }

        Object[] parameters = getParameters(cycle);

        cycle.setServiceParameters(parameters);
        direct.trigger(cycle);

        // Render the response.  This will be the response page (the first element in the context)
        // unless the direct (or its delegate) changes it.

        engine.renderResponse(cycle, output);
View Full Code Here

Examples of org.apache.tapestry.IDirect

        IEngineServiceView engine,
        IRequestCycle cycle,
        ResponseOutputStream output)
        throws ServletException, IOException
    {
        IDirect direct;
        int count = 0;
        String componentPageName;
        IPage componentPage;
        RequestContext requestContext = cycle.getRequestContext();
        String[] serviceContext = getServiceContext(requestContext);

        if (serviceContext != null)
            count = serviceContext.length;

        if (count != 3 && count != 4)
            throw new ApplicationRuntimeException(
                Tapestry.getMessage("DirectService.context-parameters"));

        boolean complex = count == 4;

        int i = 0;
        String stateful = serviceContext[i++];
        String pageName = serviceContext[i++];

        if (complex)
            componentPageName = serviceContext[i++];
        else
            componentPageName = pageName;

        String componentPath = serviceContext[i++];

        IPage page = cycle.getPage(pageName);

        cycle.activate(page);

        if (complex)
            componentPage = cycle.getPage(componentPageName);
        else
            componentPage = page;

        IComponent component = componentPage.getNestedComponent(componentPath);

        try
        {
            direct = (IDirect) component;
        }
        catch (ClassCastException ex)
        {
            throw new ApplicationRuntimeException(
                Tapestry.format("DirectService.component-wrong-type", component.getExtendedId()),
                component,
                null,
                ex);
        }

        // Check for a StateSession only the session was stateful when
        // the Gesture was created.

        if (stateful.equals(STATEFUL_ON) && direct.isStateful())
        {
            HttpSession session = cycle.getRequestContext().getSession();

            if (session == null || session.isNew())
                throw new StaleSessionException(
                    Tapestry.format(
                        "DirectService.stale-session-exception",
                        direct.getExtendedId()),
                    direct.getPage());
        }

        Object[] parameters = getParameters(cycle);

        cycle.setServiceParameters(parameters);
        direct.trigger(cycle);

        // Render the response.  This will be the response page (the first element in the context)
        // unless the direct (or its delegate) changes it.

        engine.renderResponse(cycle, output);
View Full Code Here

Examples of org.apache.tapestry.IDirect

    {
        MockControl pagec = newControl(IPage.class);
        IPage page = (IPage) pagec.getMock();

        MockControl componentc = newControl(IDirect.class);
        IDirect component = (IDirect) componentc.getMock();

        component.getPage();
        componentc.setReturnValue(page);

        page.getPageName();
        pagec.setReturnValue("Fred");

        component.getIdPath();
        componentc.setReturnValue("foo.bar");

        replayControls();

        DirectCallback callback = new DirectCallback(component, null);

        assertEquals("DirectCallback[Fred/foo.bar]", callback.toString());

        verifyControls();

        IRequestCycle cycle = newCycle("Fred", page);

        page.getNestedComponent("foo.bar");
        pagec.setReturnValue(component);

        cycle.setListenerParameters(null);

        component.trigger(cycle);

        replayControls();

        callback.performCallback(cycle);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.