Package org.apache.tapestry.engine

Examples of org.apache.tapestry.engine.IScriptSource


        verify();
    }
   
    public void test_NoParam_Exception()
    {
      IScriptSource source = newScriptSource();
       
        PageRenderSupport support = newPageRenderSupport();
        IRequestCycle cycle = newCycle(false, false);
        IMarkupWriter writer = newWriter();
        IRender body = newRender();
View Full Code Here


        verify();
    }   
   
    public void test_IAsset_NotFound_Exception()
    {
        IScriptSource source = newScriptSource();
        IScript script = newScript();
       
        PageRenderSupport support = newPageRenderSupport();
       
        IRequestCycle cycle = newCycle(false, null);
       
        trainGetPageRenderSupport(cycle, support);
       
        IMarkupWriter writer = newWriter();
        Resource scriptLocation = newResource();
        IRender body = newRender();
       
        IComponent container = newComponent();
       
        IAsset scriptAsset = newAsset();
       
        expect(scriptAsset.getResourceLocation()).andReturn(scriptLocation);

        Script component = newInstance(Script.class,
                "specification", new ComponentSpecification(),
                "container", container,
                "scriptSource", source,
                "scriptAsset", scriptAsset
        );
       
        expect(source.getScript(scriptLocation)).andThrow(new RuntimeException());
       
        replay();
       
        component.addBody(body);
       
View Full Code Here

        verify();
    }     
   
    public void test_IAsset_Param_Render()
    {
        IScriptSource source = newScriptSource();
        IScript script = newScript();
       
        PageRenderSupport support = newPageRenderSupport();
       
        IRequestCycle cycle = newCycle(false, null);
View Full Code Here

        IValidator validator = newMock(IValidator.class);
        ValueConverter vc = newMock(ValueConverter.class);
       
        BeanFactory vbf = newMock(BeanFactory.class);

        IScriptSource scriptSource = newMock(IScriptSource.class);
       
        expect(vbf.get("foo,bar=baz")).andReturn(validator);
       
        Location l = newLocation();
       
View Full Code Here

    protected void processValidatorScript(String scriptPath, IRequestCycle cycle,
            IFormComponent field, Map symbols)
    {
        IEngine engine = field.getPage().getEngine();
        IScriptSource source = engine.getScriptSource();
        IForm form = field.getForm();

        Map finalSymbols = (symbols == null) ? new HashMap() : symbols;

        finalSymbols.put(FIELD_SYMBOL, field);
        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);
View Full Code Here

        String scriptPath = getScriptPath();

        if (scriptPath == null)
            throw Tapestry.createRequiredParameterException(this, "scriptPath");

        IScriptSource source = getScriptSource();

        // If the script path is relative, it should be relative to the Script component's
        // container (i.e., relative to a page in the application).

        Resource rootLocation = getContainer().getSpecification().getSpecificationLocation();
        Resource scriptLocation = rootLocation.getRelativeResource(scriptPath);

        try
        {
            return source.getScript(scriptLocation);
        }
        catch (RuntimeException ex)
        {
            throw new ApplicationRuntimeException(ex.getMessage(), this, getBinding("script")
                    .getLocation(), ex);
View Full Code Here

@Test
public class TestDeferredScript extends BaseComponentTestCase
{
    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();

        DeferredScript ds = new DeferredScriptImpl(r, source, null);
View Full Code Here

        verify();
    }

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

        Resource newResource = newMock(Resource.class);
        Resource r = newResource;

        Location l = newLocation();
        Throwable t = new RuntimeException("Woops!");

        expect(source.getScript(r)).andThrow(t);

        replay();

        DeferredScript ds = new DeferredScriptImpl(r, source, l);
View Full Code Here

    private static final String SYM_BUTTONNAME = "buttonName";

    protected void finishLoad()
    {
        IEngine engine = getPage().getEngine();
        IScriptSource source = engine.getScriptSource();

        IResourceLocation location =
            getSpecification().getSpecificationLocation().getRelativeLocation("DatePicker.script");

        _script = source.getScript(location);
    }
View Full Code Here

        IRequestCycle cycle,
        IFormComponent field,
        Map symbols)
    {
        IEngine engine = field.getPage().getEngine();
        IScriptSource source = engine.getScriptSource();
        IForm form = field.getForm();

        Map finalSymbols = (symbols == null) ? new HashMap() : symbols;

        finalSymbols.put(FIELD_SYMBOL, field);
        finalSymbols.put(FORM_SYMBOL, form);
        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(
View Full Code Here

TOP

Related Classes of org.apache.tapestry.engine.IScriptSource

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.