Package org.apache.tapestry

Examples of org.apache.tapestry.IPage


    public IPage getPage(IRequestCycle cycle, String pageName, IMonitor monitor)
    {
        IEngine engine = cycle.getEngine();
        Object key = buildKey(engine, pageName);
        IPage result = (IPage) _pool.get(key);

        if (result == null)
        {
            monitor.pageCreateBegin(pageName);
View Full Code Here


    }

    private IPage newPage(ContentType contentType)
    {
        MockControl control = newControl(IPage.class);
        IPage page = (IPage) control.getMock();

        page.getResponseContentType();
        control.setReturnValue(contentType);

        page.getPageName();
        control.setReturnValue("ZePage");

        return page;
    }
View Full Code Here

        writer.getNestedWriter();
        control.setReturnValue(nested);

        MarkupWriterSource source = newSource(pw, ct, writer);
        IPage page = newPage(ct);
        IEngineService assetService = newAssetService();

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

        cycle.renderPage(nested);
View Full Code Here

        // that a component from a page different than
        // the response page will render.
        // In 1.0.6, we start to record *both* the render page
        // and the component page (if different).

        IPage activePage = _requestCycle.getPage();
        IPage componentPage = component.getPage();
       
        Map parameters = new HashMap();
       
        boolean stateful = _request.getSession(false) != null;
       
        parameters.put(ServiceConstants.PAGE, activePage.getPageName());
        parameters.put(ServiceConstants.COMPONENT, component.getIdPath());
        parameters.put(ServiceConstants.CONTAINER, componentPage == activePage ? null
                : componentPage.getPageName());
        parameters.put(ServiceConstants.SESSION, stateful ? "T" : null);
       
        // handle dynamic XHR/JSON parameters
        if (dsp.isAsync() || dsp.isJson()) {
           
View Full Code Here

        String componentId = cycle.getParameter(ServiceConstants.COMPONENT);
        String componentPageName = cycle.getParameter(ServiceConstants.CONTAINER);
        String activePageName = cycle.getParameter(ServiceConstants.PAGE);
        boolean activeSession = cycle.getParameter(ServiceConstants.SESSION) != null;
       
        IPage page = cycle.getPage(activePageName);

        cycle.activate(page);

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

        IComponent component = componentPage.getNestedComponent(componentId);

        IDirect direct = null;

        try
        {
View Full Code Here

    public void renderPage(IRequestCycle cycle, String pageName)
        throws IOException
    {
        cycle.activate(pageName);

        IPage page = cycle.getPage();

        ContentType contentType = page.getResponseContentType();

        PrintWriter printWriter = _response.getPrintWriter(contentType);

        IMarkupWriter writer = _markupWriterSource.newMarkupWriter(printWriter,
                contentType);

        String namespace = _response.getNamespace();

        IMarkupWriter nested = writer.getNestedWriter();
       
        ResponseBuilder builder = new DefaultResponseBuilder(nested);
       
        PageRenderSupportImpl support = new PageRenderSupportImpl(
                _assetFactory, namespace, null, builder);

        TapestryUtils.storePageRenderSupport(cycle, support);
       
        builder.renderResponse(cycle);
       
        String id = "Tapestry Portlet " + _applicationId + " " + namespace;

        writer.comment("BEGIN " + id);
        writer.comment("Page: " + page.getPageName());
        writer.comment("Generated: " + new Date());
        writer.comment("Framework version: " + Tapestry.VERSION);

        support.writeBodyScript(writer, cycle);
View Full Code Here

        Iterator i = _loadedPages.values().iterator();

        while (i.hasNext())
        {
            IPage page = (IPage) i.next();

            _pageSource.releasePage(page);
        }

        _loadedPages = null;
View Full Code Here

    public IPage getPage(String name)
    {
        Defense.notNull(name, "name");

        IPage result = null;

        if (_loadedPages != null)
            result = (IPage) _loadedPages.get(name);

        if (result == null)
View Full Code Here

        return result;
    }

    private IPage loadPage(String name)
    {
        IPage result = _pageSource.getPage(this, name);

        // Get the recorder that will eventually observe and record
        // changes to persistent properties of the page.

        IPageRecorder recorder = getPageRecorder(name);

        // Have it rollback the page to the prior state. Note that
        // the page has a null observer at this time (which keeps
        // these changes from being sent to the page recorder).

        recorder.rollback(result);

        // Now, have the page use the recorder for any future
        // property changes.

        result.setChangeObserver(recorder);

        return result;

    }
View Full Code Here

     * @since 1.0.2
     */

    public void rewindForm(IForm form)
    {
        IPage page = form.getPage();
        _rewinding = true;
       
        _targetComponent = form;

        try
        {
            page.beginPageRender();

            form.rewind(NullWriter.getSharedInstance(), this);

            // Shouldn't get this far, because the form should
            // throw the RenderRewoundException.

            throw new StaleLinkException(Tapestry.format("RequestCycle.form-rewind-failure", form
                    .getExtendedId()), form);
        }
        catch (RenderRewoundException ex)
        {
            // This is acceptible and expected.
        }
        catch (ApplicationRuntimeException ex)
        {
            // RequestCycleExceptions don't need to be wrapped.
            throw ex;
        }
        catch (Throwable ex)
        {
            // But wrap other exceptions in a ApplicationRuntimeException ... this
            // will ensure that some of the context is available.

            throw new ApplicationRuntimeException(ex.getMessage(), page, null, ex);
        }
        finally
        {
            page.endPageRender();

            reset();
            _rewinding = false;
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.IPage

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.