Package org.apache.tapestry

Examples of org.apache.tapestry.Asset


        if (path == null) return null;

        String expanded = _symbolSource.expandSymbols(path.value());

        Asset asset = _source.getAsset(null, expanded, null);

        return _typeCoercer.coerce(asset, objectType);
    }
View Full Code Here


    public Binding newBinding(String description, ComponentResources container, ComponentResources component,
                              String expression, Location location)
    {
        Resource baseResource = container.getBaseResource();

        Asset asset = _source.getAsset(baseResource, expression, container.getLocale());

        return new AssetBinding(description, asset, location);
    }
View Full Code Here

    @Test
    public void relative_asset()
    {
        AssetFactory factory = mockAssetFactory();
        ThreadLocale threadLocale = mockThreadLocale();
        Asset asset = mockAsset();

        Resource expectedResource = _baseResource.forFile("SimpleComponent_en_GB.properties");

        train_getRootResource(factory, _rootResource);
View Full Code Here

    @Test
    public void get_classpath_asset()
    {
        AssetFactory factory = mockAssetFactory();
        ThreadLocale threadLocale = mockThreadLocale();
        Asset asset = mockAsset();

        Resource expectedResource = _baseResource.forFile("SimpleComponent_en_GB.properties");

        train_getRootResource(factory, _rootResource);
View Full Code Here

    @Test
    public void get_classpath_asset_for_unspecified_locale()
    {
        AssetFactory factory = mockAssetFactory();
        ThreadLocale threadLocale = mockThreadLocale();
        Asset asset = mockAsset();
        Locale locale = Locale.UK;

        Resource expectedResource = _baseResource.forFile("SimpleComponent_en_GB.properties");

        train_getRootResource(factory, _rootResource);
View Full Code Here

    @Test
    public void absolute_asset_with_known_prefix()
    {
        AssetFactory factory = mockAssetFactory();
        ThreadLocale threadLocale = mockThreadLocale();
        Asset asset = mockAsset();

        Resource expectedResource = _rootResource
                .forFile("org/apache/tapestry/internal/services/SimpleComponent_en_GB.properties");

        train_getRootResource(factory, _rootResource);
View Full Code Here

        return path;
    }

    public Asset createAsset(final Resource resource)
    {
        return new Asset()
        {
            public Resource getResource()
            {
                return resource;
            }
View Full Code Here

    private void addScriptLinkFromClasspath(String path)
    {
        String expanded = _symbolSource.expandSymbols(path);

        Asset asset = _assetSource.getAsset(null, expanded, null);

        _builder.addScriptLink(asset.toClientURL());
    }
View Full Code Here

    @Test
    public void add_links_do_nothing()
    {
        PageRenderSupport prs = new PartialRenderPageRenderSupport();

        Asset asset = mockAsset();

        replay();

        prs.addScriptLink(asset);
        prs.addClasspathScriptLink("foo/bar.js");
View Full Code Here

        replay();

        AssetFactory factory = new ContextAssetFactory(request, context, optimizer);

        Asset asset = factory.createAsset(r);

        assertSame(asset.getResource(), r);
        assertEquals(asset.toClientURL(), "/opt/path1");

        // In real life, toString() is the same as toClientURL(), but we're testing
        // that the optimize method is getting called, basically.

        assertEquals(asset.toString(), "/opt/path2");

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.Asset

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.