Package com.volantis.mcs.assets

Examples of com.volantis.mcs.assets.DeviceImageAsset


            pageContext.getRequestContext();
        TestEnvironmentContext envContext =
            (TestEnvironmentContext)pageContext.getEnvironmentContext();

        // This asset exists
        final DeviceImageAsset imageAsset =
            new DeviceImageAsset(
                "jug", 15, 15, 1,
                ImageAsset.MONOCHROME, ImageAsset.JPEG,
                "Master", null,
                "/com/volantis/mcs/runtime/packagers/mime/jug.jpg");

        // This asset does not
        final DeviceImageAsset noImageAsset =
            new DeviceImageAsset(
                "nojug", 15, 15, 1,
                ImageAsset.MONOCHROME, ImageAsset.JPEG,
                "Master", null,
                "/com/volantis/mcs/runtime/packagers/mime/nojug.jpg");

        final StringBuffer bodyContent = new StringBuffer();

        PackageBodySource bodySource = new PackageBodySource() {
            public void write(PackageBodyOutput writer,
                              MarinerRequestContext context, Object bodyContext)
                throws PackagingException {
                try {
                    bodyContent.append("<html><body><div><img src=\"").
                        append(handler.rewriteAssetURL(
                            context, imageAsset,
                            null, new MarinerURL(imageAsset.getValue())).
                               getExternalForm()).
                        append("\"/></div><div><img src=\"").
                        append(handler.rewriteAssetURL(
                            context, noImageAsset,
                            null, new MarinerURL(noImageAsset.getValue())).
                               getExternalForm()).
                        append("\"/></div></body></html>");
                    writer.getWriter().write(bodyContent.toString());
                } catch (RepositoryException e) {
                    throw new PackagingException(e);
View Full Code Here


            ((ConvertibleImageAsset)asset).setPreserveLeft(
                    metaData.getPreserveLeft());
            ((ConvertibleImageAsset)asset).setPreserveRight(
                    metaData.getPreserveRight());
        } else {
            asset = new DeviceImageAsset();
        }

        setAssetIdentity(policy, asset);

        asset.setEncoding(ENCODING_MAP.get(metaData.getImageEncoding()));
View Full Code Here

TOP

Related Classes of com.volantis.mcs.assets.DeviceImageAsset

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.