Package org.apache.tapestry

Examples of org.apache.tapestry.PageRenderSupport


        engine.getClassResolver();
        enginec.setReturnValue(getClassResolver());

        MockControl supportc = newControl(PageRenderSupport.class);
        PageRenderSupport support = (PageRenderSupport) supportc.getMock();

        trainGetPageRenderSupport(cyclec, cycle, support);

        replayControls();

        final FormSupport fs = new FormSupportImpl(writer, cycle, form);

        verifyControls();

        IRender body = new IRender()
        {

            public void render(final IMarkupWriter writer, IRequestCycle cycle)
            {
                fs.addDeferredRunnable(new Runnable()
                {

                    public void run()
                    {
                        writer.print("DEFERRED");
                    }

                });
            }

        };

        form.setBody(body);

        MockControl linkc = newControl(ILink.class);
        ILink link = (ILink) linkc.getMock();

        IRender render = (IRender) newMock(IRender.class);

        support.addExternalScript(new ClasspathResource(getClassResolver(),
                "/org/apache/tapestry/form/Form.js"));

        support
                .addInitializationScript("var myform_events = new FormEventManager(document.myform);");

        link.getParameterNames();
        linkc.setReturnValue(new String[]
        { "service" });
View Full Code Here


        engine.getClassResolver();
        enginec.setReturnValue(getClassResolver());

        MockControl supportc = newControl(PageRenderSupport.class);
        PageRenderSupport support = (PageRenderSupport) supportc.getMock();

        trainGetPageRenderSupport(cyclec, cycle, support);

        replayControls();

        final FormSupport fs = new FormSupportImpl(writer, cycle, form);

        verifyControls();

        form.setBody(new IRender()
        {
            public void render(IMarkupWriter writer, IRequestCycle cycle)
            {
                fs.addEventHandler(FormEventType.SUBMIT, "mySubmit()");
            }
        });

        MockControl linkc = newControl(ILink.class);
        ILink link = (ILink) linkc.getMock();

        IRender render = (IRender) newMock(IRender.class);

        support.addExternalScript(new ClasspathResource(getClassResolver(),
                "/org/apache/tapestry/form/Form.js"));

        support
                .addInitializationScript("var myform_events = new FormEventManager(document.myform);");

        link.getParameterNames();
        linkc.setReturnValue(new String[]
        { "service" });

        link.getParameterValues("service");
        linkc.setReturnValue(new String[]
        { "fred" });

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

        link.getURL(null, false);
        linkc.setReturnValue("/app");

        writer.begin("form");
        writer.attribute("method", "post");
        writer.attribute("action", "/app");

        writer.attribute("name", "myform");

        render.render(writer, cycle);

        writer.println();

        trainHidden(writer, "formids", "");
        trainHidden(writer, "service", "fred");
        trainHidden(writer, "submitmode", "");

        nested.close();

        writer.end();

        support
                .addInitializationScript("myform_events.addSubmitListener(function (event)\n{\n  mySubmit();\n});\n");

        trainGetFocusField(delegatec, delegate, null);

        replayControls();
View Full Code Here

        Infrastructure inf = newInfrastructure(resolver);

        cycle.getInfrastructure();
        cyclec.setReturnValue(inf);

        PageRenderSupport prs = newSupport();

        trainGetAttribute(cyclec, cycle, TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE, prs);

        replayControls();
View Full Code Here

        Infrastructure inf = newInfrastructure(resolver);

        cycle.getInfrastructure();
        cyclec.setReturnValue(inf);

        PageRenderSupport prs = newSupport();

        Resource expected = new ClasspathResource(resolver, "/foo.js");

        prs.addExternalScript(expected);

        trainGetAttribute(cyclec, cycle, TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE, prs);

        replayControls();
View Full Code Here

        Infrastructure inf = newInfrastructure(resolver);

        cycle.getInfrastructure();
        cyclec.setReturnValue(inf);

        PageRenderSupport prs = newSupport();

        prs.addInitializationScript("document.myform.events.addSubmitListener(foo);");

        trainGetAttribute(cyclec, cycle, TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE, prs);

        replayControls();
View Full Code Here

        ClassResolver cr = (ClassResolver) newMock(ClassResolver.class);

        MockControl infrac = newControl(Infrastructure.class);
        Infrastructure infra = (Infrastructure) infrac.getMock();

        PageRenderSupport prs = (PageRenderSupport) newMock(PageRenderSupport.class);

        cycle.getInfrastructure();
        cyclec.setReturnValue(infra);

        infra.getClassResolver();
View Full Code Here

    /**
     * Executes the associated script, which generates all the JavaScript to support this Palette.
     */
    private void runScript(IRequestCycle cycle)
    {
        PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, this);

        setImage(pageRenderSupport, cycle, "selectImage", getSelectImage());
        setImage(pageRenderSupport, cycle, "selectDisabledImage", getSelectDisabledImage());
        setImage(pageRenderSupport, cycle, "deselectImage", getDeselectImage());
        setImage(pageRenderSupport, cycle, "deselectDisabledImage", getDeselectDisabledImage());
View Full Code Here

        IScript script = source.getScript(location);

        // If there's an error, report it against the field (this validator object doesn't
        // have a location).

        PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, field);

        script.execute(cycle, pageRenderSupport, finalSymbols);
    }
View Full Code Here

    /**
     * @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
     */
    protected void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, this);

        boolean disabled = isDisabled();
        DateTranslator translator = (DateTranslator) getTranslator();
        Locale locale = getPage().getLocale();
        SimpleDateFormat format = translator.getDateFormat(locale);
View Full Code Here

        ClassResolver cr = (ClassResolver) newMock(ClassResolver.class);

        MockControl infrac = newControl(Infrastructure.class);
        Infrastructure infra = (Infrastructure) infrac.getMock();

        PageRenderSupport prs = (PageRenderSupport) newMock(PageRenderSupport.class);

        cycle.getInfrastructure();
        cyclec.setReturnValue(infra);

        infra.getClassResolver();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.PageRenderSupport

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.