Package com.volantis.mcs.protocols

Examples of com.volantis.mcs.protocols.ImageAttributes


        privateSetUp();
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
       
        // Initialise our protocol attributes with an id attribute.
        ImageAttributes attributes = new ImageAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        attributes.setLocalSrc(true);
        attributes.setSrc("myImage.jpg");
        attributes.setAltText("Alternate Text");

        protocol.doImage(buffer, attributes);
       
        // valid src and alt generates <img src="url" alt="text" />
        Element root = buffer.getCurrentElement();
View Full Code Here


        buffer.initialise();
       
        String expected = "Alternate Text";
       
        // Initialise our protocol attributes with an id attribute.
        ImageAttributes attributes = new ImageAttributes();
        attributes.setLocalSrc(true);
        attributes.setSrc(null);
        attributes.setAltText(expected);

        protocol.doImage(buffer, attributes);
       
        // No src with alt text generates <span>text</span>
        Element root = buffer.getCurrentElement();
View Full Code Here

        privateSetUp();
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
       
        // Initialise our protocol attributes with an id attribute.
        ImageAttributes attributes = new ImageAttributes();
        attributes.setLocalSrc(true);
        attributes.setSrc(null);
        attributes.setAltText("    ");

        protocol.doImage(buffer, attributes);
       
        // No src and whitespace text generates no output
        Element root = buffer.getCurrentElement();
View Full Code Here

        // Needed to allow the call to getTextFromReference within doImage to work
        context = new TestMarinerPageContext();

        protocol.setMarinerPageContext(context);

        ImageAttributes attrs = new ImageAttributes();
        attrs.setStyles(StylesBuilder.getInitialValueStyles());
        attrs.setSrc("http://www.volantis.com/my_image.jpg");
        attrs.setLocalSrc(true);
        attrs.setAltText("my_alt_text");
        attrs.setWidth("10");
        attrs.setHeight("20");
        attrs.setBorder("5");

        protocol.doImage(buffer, attrs);

        String expected = "<img alt=\"my_alt_text\" border=\"5\" " +
                "height=\"20\" src=\"http://www.volantis.com/my_image.jpg\" " +
View Full Code Here

        buffer.initialise();

        String expected = "Alternate Text";

        // Initialise our protocol attributes with an id attribute.
        ImageAttributes attributes = new ImageAttributes();
        attributes.setLocalSrc(true);
        attributes.setSrc(null);
        attributes.setAltText(expected);

        protocol.doImage(buffer, attributes);

        // No src with alt text generates text as there is currently no support
        // for <span> in HDML.
View Full Code Here

     * Test writeImage with no pane defined
     */
    public void testWriteImageNoPane() {
        privateSetUp();

        ImageAttributes ia = new ImageAttributes();
        ia.setPane(null);
        ia.setAlign("left");
        ia.setAltText("AltText");
        ia.setBorder("1");
        ia.setSrc("http://www.images.com/test/test.jpg");
        try {
            protocol.writeImage(ia);
            fail("Should have thrown illegal argument exception.");
        } catch (IllegalArgumentException iae) {
            // Expected as neither the attributes or page context
View Full Code Here

     * Test writeImage with pane defined in the attributes
     */
    public void testWriteImageAttributePane() throws ProtocolException {
        privateSetUp();

        ImageAttributes ia = new ImageAttributes();
        ia.setStyles(StylesBuilder.getDeprecatedStyles());
        Pane outPane = new Pane(null);
        outPane.setName("MyPane");
        outPane.setDestinationArea(null);
        ia.setPane(outPane);
        ia.setAltText("AltText");
        ia.setSrc("http://www.images.com/test/test.jpg");
        ia.setLocalSrc(false);
        protocol.writeImage(ia);

        // Check the image tag and attributes
        Element nullElement = buffer.popElement();
        Element element = (Element) nullElement.getHead();
View Full Code Here

     * Test writeImage with pane defined in the page context
     */
    public void testWriteImageContextPane() throws ProtocolException {
        privateSetUp();

        ImageAttributes ia = new ImageAttributes();
        ia.setStyles(StylesBuilder.getDeprecatedStyles());
        Pane outPane = new Pane(null);
        outPane.setName("MyPane");

        outPane.setDestinationArea(null);
        pageContext.setCurrentPane(outPane);
        ia.setPane(null);
        ia.setAltText("AltText");
        ia.setSrc("http://www.images.com/test/test.jpg");
        ia.setLocalSrc(false);
        protocol.writeImage(ia);

        // Check the image tag and attributes
        Element nullElement = buffer.popElement();
        Element element = (Element) nullElement.getHead();
View Full Code Here

        privateSetUp();
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();

        // Initialise our protocol attributes with an id attribute.
        ImageAttributes attributes = new ImageAttributes();
        attributes.setStyles(StylesBuilder.getDeprecatedStyles());
        attributes.setLocalSrc(true);
        attributes.setSrc("myImage.jpg");
        attributes.setAltText("Alternate Text");

        Pane outPane = new Pane(null);
        outPane.setName("MyPane");
        outPane.setDestinationArea(null);
        attributes.setPane(outPane);

        protocol.doImage(buffer, attributes);

        // valid src and alt generates <img src="url" alt="text" />
        Element root = buffer.getCurrentElement();
View Full Code Here

        buffer.initialise();

        String expected = "Alternate Text";

        // Initialise our protocol attributes with an id attribute.
        ImageAttributes attributes = new ImageAttributes();
        attributes.setLocalSrc(true);
        attributes.setSrc(null);
        attributes.setAltText(expected);

        Pane outPane = new Pane(null);
        outPane.setName("MyPane");
        outPane.setDestinationArea(null);
        attributes.setPane(outPane);

        protocol.doImage(buffer, attributes);

        // No src with alt text generates <span>text</span>
        Element root = buffer.getCurrentElement();
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.ImageAttributes

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.