Package org.apache.tapestry

Examples of org.apache.tapestry.Asset


    {
        // TODO: Assets will eventually have a kind of symbolic link used
        // to shorten the path. Some assets may need to have a checksum embedded
        // in the path as well.

        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.findAsset(null, expanded, null);

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

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

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

        return new LiteralBinding(description, asset, location);

    }
View Full Code Here

        if (path == null) return null;

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

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

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

    @Test
    public void add_script_link_by_asset()
    {
        DocumentHeadBuilder builder = mockDocumentScriptBuilder();
        Asset asset = mockAsset();

        train_toClientURL(asset, ASSET_URL);
        builder.addScriptLink(ASSET_URL);

        replay();
View Full Code Here

    @Test
    public void core_assets_added()
    {
        getMocksControl().checkOrder(true);

        Asset coreAsset = mockAsset();
        DocumentHeadBuilder builder = mockDocumentScriptBuilder();
        Asset asset = mockAsset();
        AssetSource assetSource = mockAssetSource();
        SymbolSource symbolSource = mockSymbolSource();

        train_expandSymbols(symbolSource, CORE_ASSET_PATH_UNEXPANDED, CORE_ASSET_PATH);
        train_findAsset(assetSource, null, CORE_ASSET_PATH, null, coreAsset);
View Full Code Here

    {
        String path = "${root}/foo/bar.pdf";
        String expanded = "org/apache/tapestry/foo/bar.pdf";

        DocumentHeadBuilder builder = mockDocumentScriptBuilder();
        Asset asset = mockAsset();
        SymbolSource source = mockSymbolSource();
        AssetSource assetSource = mockAssetSource();

        train_expandSymbols(source, path, expanded);
View Full Code Here

    @Test
    public void add_stylesheet_link()
    {
        String media = "print";
        DocumentHeadBuilder builder = mockDocumentScriptBuilder();
        Asset asset = mockAsset();

        train_toClientURL(asset, ASSET_URL);
        builder.addStylesheetLink(ASSET_URL, media);

        replay();
View Full Code Here

    @Test
    public void normal_conversion()
    {
        AssetSource source = mockAssetSource();
        ObjectLocator locator = mockObjectLocator();
        Asset asset = mockAsset();
        String path = "${foo}";
        String expanded = "foo/bar/baz.gif";
        AnnotationProvider annotationProvider = mockAnnotationProvider();
        TypeCoercer typeCoercer = mockTypeCoercer();
        Path pathAnnotation = mockPath();
        SymbolSource symbolSource = mockSymbolSource();

        train_getAnnotation(annotationProvider, Path.class, pathAnnotation);
        train_value(pathAnnotation, path);
        train_expandSymbols(symbolSource, path, expanded);
        train_findAsset(source, null, expanded, null, asset);
        train_coerce(typeCoercer, asset, Asset.class, asset);

        replay();

        ObjectProvider provider = new AssetObjectProvider(source, typeCoercer, symbolSource);

        Asset result = provider.provide(Asset.class, annotationProvider, locator);

        assertSame(result, asset);

        verify();
    }
View Full Code Here

    public Asset createAsset(final Resource resource)
    {
        final String contextPath = _request.getContextPath() + "/" + resource.getPath();

        return new Asset()
        {
            public Resource getResource()
            {
                return resource;
            }
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.