Package org.apache.tapestry

Examples of org.apache.tapestry.IScript


    /**
     * 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


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

        IResourceLocation scriptLocation =
            getSpecification().getSpecificationLocation().getRelativeLocation(
                "InspectorButton.script");

        IScript script = source.getScript(scriptLocation);

        Map symbols = new HashMap();

        IEngineService service = engine.getService(Tapestry.DIRECT_SERVICE);
        ILink link = service.getLink(cycle, this, null);

        symbols.put("URL", link.getURL());

        Body body = Body.get(cycle);

        if (body == null)
            throw new ApplicationRuntimeException(
                Tapestry.getMessage("InspectorButton.must-be-contained-by-body"),
                this,
                null,
                null);

        script.execute(cycle, body, symbols);

        // Now, go render the rest from the template.

        super.renderComponent(writer, cycle);
    }
View Full Code Here

        __CLOVER_445_0.S[9857]++;finalSymbols.put(VALIDATOR_SYMBOL, this);

        __CLOVER_445_0.S[9858]++;Resource location =
            new ClasspathResource(engine.getClassResolver(), scriptPath);

        __CLOVER_445_0.S[9859]++;IScript script = source.getScript(location);

        __CLOVER_445_0.S[9860]++;Body body = Body.get(cycle);

        __CLOVER_445_0.S[9861]++;if ((((body == null) && (++__CLOVER_445_0.CT[1688] != 0)) || (++__CLOVER_445_0.CF[1688] == 0))){
            __CLOVER_445_0.S[9862]++;throw new ApplicationRuntimeException(
                Tapestry.getMessage("ValidField.must-be-contained-by-body"),
                field,
                null,
                null);}

        __CLOVER_445_0.S[9863]++;script.execute(cycle, body, finalSymbols);

        __CLOVER_445_0.S[9864]++;String functionName = (String) finalSymbols.get(FUNCTION_SYMBOL);

        __CLOVER_445_0.S[9865]++;form.addEventHandler(FormEventType.SUBMIT, functionName);
    } finally { }}
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

        __CLOVER_79_0.S[1986]++;_cache.clear();
    } finally { }}

    public synchronized IScript getScript(Resource resource)
    {try { __CLOVER_79_0.M[457]++;
        __CLOVER_79_0.S[1987]++;IScript result = (IScript) _cache.get(resource);

        __CLOVER_79_0.S[1988]++;if ((((result != null) && (++__CLOVER_79_0.CT[374] != 0)) || (++__CLOVER_79_0.CF[374] == 0))){
            __CLOVER_79_0.S[1989]++;return result;}

        __CLOVER_79_0.S[1990]++;result = parse(resource);
View Full Code Here

        __CLOVER_79_0.S[12455]++;_cache.clear();
    } finally { }}

    public synchronized IScript getScript(Resource resource)
    {try { __CLOVER_79_0.M[3027]++;
        __CLOVER_79_0.S[12456]++;IScript result = (IScript) _cache.get(resource);

        __CLOVER_79_0.S[12457]++;if ((((result != null) && (++__CLOVER_79_0.CT[2135] != 0)) || (++__CLOVER_79_0.CF[2135] == 0))){
            __CLOVER_79_0.S[12458]++;return result;}

        __CLOVER_79_0.S[12459]++;result = parse(resource);
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);
    }
View Full Code Here

        finalSymbols.put(VALIDATOR_SYMBOL, this);

        IResourceLocation location =
            new ClasspathResourceLocation(engine.getResourceResolver(), scriptPath);

        IScript script = source.getScript(location);

    Body body = Body.get(cycle);

    if (body == null)
      throw new ApplicationRuntimeException(
        Tapestry.getMessage("ValidField.must-be-contained-by-body"),
        field);
       
        script.execute(cycle, body, finalSymbols);

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

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

        IResourceLocation scriptLocation =
            getSpecification().getSpecificationLocation().getRelativeLocation(
                "InspectorButton.script");

        IScript script = source.getScript(scriptLocation);

        Map symbols = new HashMap();

        IEngineService service = engine.getService(Tapestry.DIRECT_SERVICE);
        ILink link = service.getLink(cycle, this, null);

        symbols.put("URL", link.getURL());

    Body body = Body.get(cycle);

     if (body == null)
       throw new ApplicationRuntimeException(
         Tapestry.getMessage("InspectorButton.must-be-contained-by-body"),
         this);

    script.execute(cycle, body, symbols);

        // Now, go render the rest from the template.

        super.renderComponent(writer, cycle);
    }
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.