Package org.apache.tapestry

Examples of org.apache.tapestry.IScript


        _cache.clear();
    }

    public synchronized IScript getScript(IResourceLocation scriptLocation)
    {
        IScript result = (IScript) _cache.get(scriptLocation);

        if (result != null)
            return result;

        result = parse(scriptLocation);
View Full Code Here


    public void testRenderNormal()
    {
        IMarkupWriter writer = newBufferWriter();
        IRequestCycle cycle = newCycle();
        IScript script = new ScriptFixture();
        PageRenderSupport support = newPageRenderSupport();

        IForm form = newForm();

        LinkSubmit linkSubmit = (LinkSubmit) newInstance(LinkSubmit.class, new Object[]
View Full Code Here

        finalSymbols.put(FORM_SYMBOL, form);
        finalSymbols.put(VALIDATOR_SYMBOL, this);

        Resource location = new ClasspathResource(engine.getClassResolver(), scriptPath);

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

        String functionName = (String) finalSymbols.get(FUNCTION_SYMBOL);

        form.addEventHandler(FormEventType.SUBMIT, functionName);
    }
View Full Code Here

    public void testRenderNormal()
    {
        IMarkupWriter writer = newBufferWriter();
        IRequestCycle cycle = newCycle();
        IScript script = new ScriptFixture();
        PageRenderSupport support = newPageRenderSupport();

        IForm form = newForm();

        LinkSubmit linkSubmit = (LinkSubmit) newInstance(LinkSubmit.class, new Object[]
View Full Code Here

    public void testRenderNormal()
    {
        IMarkupWriter writer = newBufferWriter();
        IRequestCycle cycle = newCycle();
        IScript script = new ScriptFixture();
        PageRenderSupport support = newPageRenderSupport();

        IForm form = newForm();

        LinkSubmit linkSubmit = newInstance(LinkSubmit.class, new Object[]
View Full Code Here

        return parser.parse(scriptLocation);
    }

    private IScript execute(String file, Map symbols) throws DocumentParseException
    {
        IScript script = read(file);

        IRequestCycle cycle = newMock(IRequestCycle.class);

        replay();

        script.execute(cycle, _processor, symbols);

        verify();

        return script;
    }
View Full Code Here

     * @since 3.0
     */

    public void testUnique() throws Exception
    {
        IScript script = read("unique.script");

        IRequestCycle cycle = new RequestCycle();

        script.execute(cycle, _processor, null);
        script.execute(cycle, _processor, null);

        assertEquals("Block1\nBlock2\nNotUnique\n\n\n\nNotUnique", _processor.getBody().trim());
    }
View Full Code Here

        assertSymbol(symbols, "gamma", "Alpha_1");
    }

    public void testIncludeScript() throws Exception
    {
        IScript script = execute("include-script.script", null);

        Resource scriptLocation = script.getScriptResource();

        Resource[] expected = new Resource[]
        { scriptLocation.getRelativeResource("first"),
                scriptLocation.getRelativeResource("second"),
                scriptLocation.getRelativeResource("third") };
View Full Code Here

    /**
     * A bunch of quickies to push up the code coverage numbers.
     */
    public void testCheats() throws Exception
    {
        IScript script = execute("simple.script", null);

        ScriptSession session = new ScriptSessionImpl(script.getScriptResource(), null, null,
                createExpressionEvaluator(), null, null);
        assertEquals("ScriptSession[" + script.getScriptResource() + "]", session.toString());
    }
View Full Code Here

        MockDelegate delegate = new MockDelegate();
       
        IEngineService engine = newEngineService();
        ILink link = newLink();
       
        IScript script = newMock(IScript.class);
       
        SimpleBean match = new SimpleBean(new Integer(2), "Simple 2", 200);
       
        Autocompleter component = newInstance(Autocompleter.class,
                new Object[] {
            "name", "fred", "model", model,
            "directService", engine,
            "script", script,
            "validatableFieldSupport", vfs,
            "value", match,
            "dataSqueezer", ds
        });
       
        expect(cycle.renderStackPush(component)).andReturn(component);
       
        expect(form.getName()).andReturn("testform").anyTimes();
       
        form.setFormFieldUpdating(true);
       
        IMarkupWriter writer = newBufferWriter();
       
        DirectServiceParameter dsp =
            new DirectServiceParameter(component);
       
        trainGetForm(cycle, form);
        trainWasPrerendered(form, writer, component, false);
       
        trainGetDelegate(form, delegate);
       
        delegate.setFormComponent(component);
       
        trainGetElementId(form, component, "fred");
        trainIsRewinding(form, false);
        expect(cycle.isRewinding()).andReturn(false).anyTimes();
       
        delegate.setFormComponent(component);
       
        expect(cycle.getResponseBuilder()).andReturn(resp).anyTimes();
        expect(resp.isDynamic()).andReturn(false).anyTimes();
       
        vfs.renderContributions(component, writer, cycle);
       
        trainGetLinkCheckIgnoreParameter(engine, cycle, true, dsp, link);
       
        trainGetURL(link, "urlstring");
       
        PageRenderSupport prs = newPageRenderSupport();
        trainGetPageRenderSupport(cycle, prs);
       
        expect(ds.squeeze(2)).andReturn("2p");
       
        script.execute(eq(component), eq(cycle), eq(prs), isA(Map.class));
       
        expect(cycle.renderStackPop()).andReturn(component);
       
        replay();
       
View Full Code Here

TOP

Related Classes of org.apache.tapestry.IScript

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.