Package org.apache.tapestry

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);

        HttpServletRequest request = newRequest(null);

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

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


    public void performCallback(IRequestCycle cycle)
    {
        IPage page = cycle.getPage(_pageName);
        IComponent component = page.getNestedComponent(_componentIdPath);
        IDirect direct = null;

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

        cycle.setServiceParameters(_parameters);
        direct.trigger(cycle);
    }
View Full Code Here

    {
        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 = newCycleGetPage("Fred", page);

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

        cycle.setListenerParameters(null);

        component.trigger(cycle);

        replayControls();

        callback.performCallback(cycle);
View Full Code Here

        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("Barney");

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

        replayControls();

        DirectCallback callback = new DirectCallback(component, params);

        assertEquals("DirectCallback[Barney/foo.bar p1, p2]", callback.toString());

        verifyControls();

        IRequestCycle cycle = newCycleGetPage("Barney", page);

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

        cycle.setListenerParameters(params);

        component.trigger(cycle);

        replayControls();

        callback.performCallback(cycle);
View Full Code Here

    {
        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);
View Full Code Here

        IPage componentPage = componentPageName == null ? page : cycle.getPage(componentPageName);

        IComponent component = componentPage.getNestedComponent(componentId);

        IDirect direct = null;

        try
        {
            direct = (IDirect) component;
        }
        catch (ClassCastException ex)
        {
            throw new ApplicationRuntimeException(EngineMessages.wrongComponentType(
                    component,
                    IDirect.class), component, null, ex);
        }

        // Check for a StaleSession only when the session was stateful when
        // the link was created.

        if (activeSession && direct.isStateful())
        {
            WebSession session = _request.getSession(false);

            if (session == null || session.isNew())
                throw new StaleSessionException(EngineMessages.requestStateSession(direct),
                        componentPage);
        }

        Object[] parameters = _linkFactory.extractListenerParameters(cycle);

        cycle.setListenerParameters(parameters);

        direct.trigger(cycle);

        // Render the response. This will be the active page
        // unless the direct component (or its delegate) changes it.

        _responseRenderer.renderResponse(cycle);
View Full Code Here

        IPage componentPage = componentPageName == null ? page : cycle.getPage(componentPageName);

        IComponent component = componentPage.getNestedComponent(componentId);

        IDirect direct = null;

        try
        {
            direct = (IDirect) component;
        }
        catch (ClassCastException ex)
        {
            throw new ApplicationRuntimeException(EngineMessages.wrongComponentType(
                    component,
                    IDirect.class), component, null, ex);
        }

        // Check for a StaleSession only when the session was stateful when
        // the link was created.

        if (activeSession && direct.isStateful())
        {
            WebSession session = _request.getSession(false);

            if (session == null || session.isNew())
                throw new StaleSessionException(EngineMessages.requestStateSession(direct),
View Full Code Here

        IEngineServiceView engine,
        IRequestCycle cycle,
        ResponseOutputStream output)
        throws ServletException, IOException
    {try { __CLOVER_80_0.M[461]++;
        __CLOVER_80_0.S[2010]++;IDirect direct;
        __CLOVER_80_0.S[2011]++;int count = 0;
        __CLOVER_80_0.S[2012]++;String componentPageName;
        __CLOVER_80_0.S[2013]++;IPage componentPage;
        __CLOVER_80_0.S[2014]++;RequestContext requestContext = cycle.getRequestContext();
        __CLOVER_80_0.S[2015]++;String[] serviceContext = getServiceContext(requestContext);

        __CLOVER_80_0.S[2016]++;if ((((serviceContext != null) && (++__CLOVER_80_0.CT[378] != 0)) || (++__CLOVER_80_0.CF[378] == 0))){
            __CLOVER_80_0.S[2017]++;count = serviceContext.length;}

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

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

        __CLOVER_80_0.S[2021]++;int i = 0;
        __CLOVER_80_0.S[2022]++;String stateful = serviceContext[i++];
        __CLOVER_80_0.S[2023]++;String pageName = serviceContext[i++];

        __CLOVER_80_0.S[2024]++;if ((((complex) && (++__CLOVER_80_0.CT[380] != 0)) || (++__CLOVER_80_0.CF[380] == 0))){
            __CLOVER_80_0.S[2025]++;componentPageName = serviceContext[i++];}
        else{
            __CLOVER_80_0.S[2026]++;componentPageName = pageName;}

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

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

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

        __CLOVER_80_0.S[2030]++;if ((((complex) && (++__CLOVER_80_0.CT[381] != 0)) || (++__CLOVER_80_0.CF[381] == 0))){
            __CLOVER_80_0.S[2031]++;componentPage = cycle.getPage(componentPageName);}
        else{
            __CLOVER_80_0.S[2032]++;componentPage = page;}

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

        __CLOVER_80_0.S[2034]++;try
        {
            __CLOVER_80_0.S[2035]++;direct = (IDirect) component;
        }
        catch (ClassCastException ex)
        {
            __CLOVER_80_0.S[2036]++;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[2037]++;if ((((stateful.equals(STATEFUL_ON) && direct.isStateful()) && (++__CLOVER_80_0.CT[382] != 0)) || (++__CLOVER_80_0.CF[382] == 0))){
        {
            __CLOVER_80_0.S[2038]++;HttpSession session = cycle.getRequestContext().getSession();

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

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

        __CLOVER_80_0.S[2042]++;cycle.setServiceParameters(parameters);
        __CLOVER_80_0.S[2043]++;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[2044]++;engine.renderResponse(cycle, output);
View Full Code Here

    public void testGetLinkOnSamePage()
    {
        IPage page = newPage("ThePage");

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

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

        WebRequest request = newWebRequest(false, null);

        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

    public void testGetLinkOnSamePageForPost()
    {
        IPage page = newPage("ThePage");

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

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

        WebRequest request = newWebRequest(false, null);

        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

TOP

Related Classes of org.apache.tapestry.IDirect

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.