Package com.volantis.mcs.assets

Examples of com.volantis.mcs.assets.ImageAsset


        final AssetResolverMock assetResolverMock =
                new AssetResolverMock("assetResolverMock", expectations);
        PrivateAccessor.setField(context, "assetResolver", assetResolverMock);

        // set up the ImageAsset
        ImageAsset imageAsset = new ConvertibleImageAsset();
        imageAsset.setValue("rotatingWorld.gif");
        imageAsset.setSequence(false);

        assetResolverMock.expects.computeURLAsString(imageAsset)
                .returns("rotatingWorld.gif").any();

        // perform the tests
View Full Code Here


        final AssetResolverMock assetResolverMock =
                new AssetResolverMock("assetResolverMock", expectations);
        PrivateAccessor.setField(context, "assetResolver", assetResolverMock);

        // set up the ImageAsset
        ImageAsset imageAsset = new ConvertibleImageAsset();
        imageAsset.setValue("rotatingWorld{$index}.gif");
        imageAsset.setSequence(true);
        imageAsset.setSequenceSize(2);

        ImageAsset imageAsset0 = (ImageAsset) imageAsset.clone();
        imageAsset0.setValue("rotatingWorld0.gif");

        ImageAsset imageAsset1 = (ImageAsset) imageAsset.clone();
        imageAsset1.setValue("rotatingWorld1.gif");

        assetResolverMock.expects.computeURLAsString(imageAsset0)
                .returns("rotatingWorld0.gif").any();
        assetResolverMock.expects.computeURLAsString(imageAsset1)
                .returns("rotatingWorld1.gif").any();
View Full Code Here

            logger.warn("asset-null-no-url");
            return null;
        }
        String[] url = null;
        if (asset.isSequence()) {
            ImageAsset clonedAsset = (ImageAsset) asset.clone();
            String originalvalue = clonedAsset.getValue();
            int sequenceSize = clonedAsset.getSequenceSize();
            url = new String[sequenceSize];

            for (int i = 0; i < sequenceSize; i++) {
                // alter the value of the url to take into account the sequence number
                String sequencedURL = getSequencedImageAssetURL(
                        originalvalue, i);
                clonedAsset.setValue(sequencedURL);
                url[i] = assetResolver.computeURLAsString(clonedAsset);
            }
        } else {
            url = new String[1];
            url[0] = assetResolver.computeURLAsString(asset);
View Full Code Here

                SelectedVariant selected =
                        assetResolver.selectBestVariant(reference, null);

                // Try and find the best image asset with the specified name.
                if (selected != null) {
                    ImageAsset imageAsset =
                            (ImageAsset) selected.getOldObject();
                    if (imageAsset == null) {
                        // No image asset which matches could be found so use the
                        // alt text, if any.

                        // And then try and write out the alt or fallback text,
                        // if we can
                        AltTextAttributes altTextAttrs =
                                new AltTextAttributes(attributes);
                        altTextAttrs.setStyles(pattributes.getStyles());
                        altText = new FallbackComponentTextAssetReference(
                                assetResolver, selected.getPolicy(), altText);
                        altTextAttrs.setAltText(altText);

                        if (protocol.writeAltText(altTextAttrs)) {
                            return SKIP_ELEMENT_BODY;
                        }

                    } else {
                        String[] srcArray = pageContext.
                                retrieveImageAssetURLAsString(imageAsset);
                        url = srcArray[0];

                        AssetGroup assetGroup =
                                assetResolver.getAssetGroup(imageAsset);
                        if (assetGroup != null) {
                            pattributes.setLocalSrc(AssetGroup.ON_DEVICE ==
                                    assetGroup.getLocationType());
                        } else {
                            pattributes.setLocalSrc(false);
                        }

                        // Make a note of whether this image is a convertible
                        // image asset
                        if (imageAsset instanceof ConvertibleImageAsset) {
                            pattributes.setConvertibleImageAsset(true);
                        } else {
                            pattributes.setConvertibleImageAsset(false);
                        }

                        pattributes.setHeight(StringConvertor.
                                valueOf(imageAsset.getPixelsY()));
                        pattributes.setWidth(StringConvertor.
                                valueOf(imageAsset.getPixelsX()));

                        ImageMetaData metadata = (ImageMetaData) selected.getVariant().getMetaData();

                        if (ImageConversionMode.ALWAYS_CONVERT ==
                            metadata.getConversionMode()) {
View Full Code Here

            ActivatedVariablePolicy policy, Variant variant,
            InternalDevice device) {

        // Convert the variant into an asset.
        ImageMetaData metaData = (ImageMetaData) variant.getMetaData();
        ImageAsset asset;
        if (metaData.getConversionMode() == ImageConversionMode.ALWAYS_CONVERT) {
            asset = new ConvertibleImageAsset();
            ((ConvertibleImageAsset)asset).setPreserveLeft(
                    metaData.getPreserveLeft());
            ((ConvertibleImageAsset)asset).setPreserveRight(
                    metaData.getPreserveRight());
        } else {
            asset = new DeviceImageAsset();
        }

        setAssetIdentity(policy, asset);

        asset.setEncoding(ENCODING_MAP.get(metaData.getImageEncoding()));
        asset.setPixelDepth(metaData.getPixelDepth());
        asset.setPixelsX(metaData.getWidth());
        asset.setPixelsY(metaData.getHeight());
        asset.setRendering(RENDERING_MAP.get(metaData.getRendering()));

        setValue(asset, variant);

        return asset;
    }
View Full Code Here

        return asset;
    }

    protected void makeDeviceLocal(SubstantiveAsset asset) {
        ImageAsset image = (ImageAsset) asset;
        image.setLocalSrc(true);
    }
View Full Code Here

        image.setLocalSrc(true);
    }

    protected void setSequence(SubstantiveAsset asset,
                               AutoURLSequence sequence) {
        ImageAsset image = (ImageAsset) asset;
        image.setSequence(true);
        image.setSequenceSize(sequence.getSequenceSize());
        image.setValue(sequence.getURLTemplate());
    }
View Full Code Here

TOP

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

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.