Package org.apache.tapestry

Examples of org.apache.tapestry.IScript


    public void testSuccess()
    {
        IScriptSource source = newMock(IScriptSource.class);

        Resource r = newMock(Resource.class);
        IScript script = newMock(IScript.class);

        expect(source.getScript(r)).andReturn(script);

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

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

        script.execute(cycle, body, finalSymbols);

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

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

        _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

        _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

        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

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

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

        script.execute(cycle, body, symbols);

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

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

     * No input symbols, no informal parameters.
     */
    public void testMinimalRender()
    {
        IScriptSource source = newScriptSource();
        IScript script = newScript();

        PageRenderSupport support = newPageRenderSupport();
        IRequestCycle cycle = newCycle(false);
        IMarkupWriter writer = newWriter();
        Resource scriptLocation = newResource();
        IRender body = newRender();

        IComponent container = newComponent();

        String scriptPath = "MyScript.script";

        Script component = (Script) newInstance(Script.class, new Object[]
        { "specification", new ComponentSpecification(), "container", container, "scriptSource",
                source, "scriptPath", scriptPath });

        trainGetPageRenderSupport(cycle, support);
       
        trainGetScriptLocation(container, scriptPath, scriptLocation);
       
        trainGetScript(source, scriptLocation, script);

        script.execute(cycle, support, new HashMap());

        body.render(writer, cycle);

        replayControls();

View Full Code Here

    }
   
    public void testIAssetParamRender()
    {
        IScriptSource source = newScriptSource();
        IScript script = newScript();
       
        PageRenderSupport support = newPageRenderSupport();
        IRequestCycle cycle = newCycle(false);
        IMarkupWriter writer = newWriter();
        Resource scriptLocation = newResource();
        IRender body = newRender();
       
        IComponent container = newComponent();
       
        IAsset scriptAsset = newAsset();
       
        scriptAsset.getResourceLocation();
        setReturnValue(scriptAsset, scriptLocation);
       
        Script component = (Script) newInstance(Script.class, new Object[]
        { "specification", new ComponentSpecification(), "container", container, "scriptSource",
                source, "scriptAsset", scriptAsset });
       
        trainGetPageRenderSupport(cycle, support);
       
        trainGetScript(source, scriptLocation, script);
       
        script.execute(cycle, support, new HashMap());
       
        body.render(writer, cycle);
       
        replayControls();
       
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.