Package com.volantis.mcs.protocols.assets

Examples of com.volantis.mcs.protocols.assets.ImageAssetReference


        ConcreteElementDetails elementDetails = new ConcreteElementDetails();
        elementDetails.setElementName("the tag name");
        elementDetails.setId("the id");
        elementDetails.setStyles(StylesBuilder.getEmptyStyles());
        ConcreteMenuIcon icon = new ConcreteMenuIcon(elementDetails);
        ImageAssetReference imageRef =
                new TestNormalImageAssetReference("the normal url");
        icon.setNormalURL(imageRef);
        ConcreteMenuItem item = new ConcreteMenuItem(
                new ElementDetailsStub(), new ConcreteMenuLabel(
                        new ElementDetailsStub(), createMenuText(),
                        icon));

        // Create the renderer we are to test.
        MenuItemComponentRenderer renderer = createImageMenuItemRenderer(
                new TestDeprecatedImageOutput(), false);

        // Do a render.
        String actual = getRenderOutputAsString(renderer, item);
        //System.out.println(actual);

        // Assemble the expected value (rendered menu item).
        String expected =
                "<test-image " +
                        "src=\"" + imageRef.getURL() + "\" " +
                        "id=\"the id\"" + " " +
//                        "style-class=\"the style class\"" + " " +
                        "tag-name=\"the tag name\"" +
                    "/>";
        expected = DOMUtilities.provideDOMNormalizedString(expected);
View Full Code Here


                .returns("/resolved.gif").any();
       
        assetResolverMock.expects.rewriteURLWithPageURLRewriter("/resolved.gif", PageURLType.IMAGE)
                .returns("/resolved.gif").any();

        ImageAssetReference test = createTestInstance(policyReferenceMock);
        String url = test.getURL();
        assertEquals("/resolved.gif", url);
//        String expected = AssetResolverTestHelper.TEST_PREFIX +
//                          AssetResolverTestHelper.TEST_NAME;
//        assertNotNull("The url should not be null", url);
//        assertEquals("URL should match: " + expected + "but was: " + url,
View Full Code Here

                        expectations);

        policyMock.expects.getAlternatePolicy(PolicyType.TEXT)
                .returns(alternativeMock).any();

        ImageAssetReference test = createTestInstance(policyReferenceMock);
        TextAssetReference fallback = test.getTextFallback();
        assertNotNull("fallback should exist", fallback);
    }
View Full Code Here

                        expectations);

        policyMock.expects.getAlternatePolicy(PolicyType.TEXT)
                .returns(alternativeMock).any();

        ImageAssetReference test = createTestInstance(policyReferenceMock);
        TextAssetReference fallback = test.getTextFallback();
        assertNull("fallback should not exist", fallback);
    }
View Full Code Here

                .returns("/resolved.gif").any();

        fetcherMock.expects.fetchPolicy(policyReferenceMock)
                .returns(policyMock).any();

        ImageAssetReference test = createTestInstance(policyReferenceMock);
        String url = test.getURL();
        assertEquals("/resolved.gif", url);
//        String expected = AssetResolverTestHelper.TEST_PREFIX +
//                          AssetResolverTestHelper.TEST_NAME;
//        assertNotNull("The url should not be null", url);
//        assertEquals("URL should match: " + expected + "but was: " + url,
View Full Code Here

                .returns(policyMock).any();

        policyMock.expects.getAlternatePolicy(PolicyType.TEXT)
                .returns(alternativeMock).any();

        ImageAssetReference test = createTestInstance(policyReferenceMock);
        TextAssetReference fallback = test.getTextFallback();
        assertNotNull("fallback should exist", fallback);
    }
View Full Code Here

                .returns(null).any();

        policyMock.expects.getAlternatePolicy(PolicyType.TEXT)
                .returns(alternativeMock).any();

        ImageAssetReference test = createTestInstance(policyReferenceMock);
        TextAssetReference fallback = test.getTextFallback();
        assertNull("fallback should not exist", fallback);
    }
View Full Code Here

        if (value == null) {
            throw new IllegalStateException(
                    "No value defined for " + property.getName());
        }

        final ImageAssetReference imageAssetReference;
        if (value instanceof StyleURI) {
            String uri = ((StyleURI) value).getURI();
            imageAssetReference = new LiteralImageAssetReference(uri);
        } else if (value instanceof StyleComponentURI) {
            StyleComponentURI styleComponentURI = (StyleComponentURI) value;

            // Resolve the identity against the project associated with the
            // value.
            RuntimePolicyReference reference =
                    resolver.resolvePolicyExpression(
                            styleComponentURI.getExpression());
            imageAssetReference = new DefaultComponentImageAssetReference(
                    reference, assetResolver);
        } else if (value instanceof StyleTranscodableURI) {
            final StyleTranscodableURI transcodableUri =
                (StyleTranscodableURI) value;
            try {
                // resolve the transcodable URL
                final String imageUrl = transcodableUrlResolver.resolve(
                    transcodableUri.getUri());

                return new ImageAssetReference() {
                    public String getURL() {
                        return imageUrl;
                    }
                    public TextAssetReference getTextFallback() {
                        return null;
View Full Code Here

                                createCharacterMenuItemGroupSeparator(chars, repeat);
                    }
                } else if (type == MCSMenuSeparatorTypeKeywords.IMAGE) {
                    // Get the remaining properties required to configure
                    // the separator
                    ImageAssetReference imageAssetReference =
                            styleResolver.getImageAssetReferenceValue(properties, StylePropertyDetails.
                            MCS_MENU_SEPARATOR_IMAGE,
                                    assetResolver);

                    separator = factory.createImageMenuItemGroupSeparator(imageAssetReference);
View Full Code Here

        // Give up straight away if there is no icon for this menu item.
        // Note that this will potentially "break" the enclosing renderer.
        MenuIcon icon = item.getLabel().getIcon();
        if (icon != null) {
            ImageAssetReference imageRef = icon.getNormalURL();

            // set the url this item points to
            try {
                // Extract the url from the image
                String imageUrl = imageRef.getURL();
                // If we were able to get one
                if (imageUrl != null) {

                    DOMOutputBuffer dom = (DOMOutputBuffer) buffer;
                    ImageAttributes attributes = new ImageAttributes();
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.assets.ImageAssetReference

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.