Package com.volantis.mcs.protocols.separator

Examples of com.volantis.mcs.protocols.separator.SeparatorRenderer


            // point rendering the menu. This will happen in the pathological
            // case where both the image and text styles are set to 'none'.
            return;
        }

        final SeparatorRenderer separator =
                separatorSelector.selectMenuItemSeparator(menu);
       
        // Construct a visitor which renders the menu.
        // @todo model could use Composite, External and/or Internal Iterator
        RendererMenuModelVisitor visitor = new RendererMenuModelVisitor() {
View Full Code Here


    /**
     * This tests the functionality of the render method with no separator.
     */
    public void testRenderWithNoSeparator() throws Exception {
        SeparatorRenderer renderer = new DefaultHorizontalSeparatorRenderer(
                MCSMenuHorizontalSeparatorKeywords.NONE);

        // Create expected
        String expected = "";

View Full Code Here

    /**
     * This tests the functionality of the render method with a space separator.
     */
    public void testRenderWithSpaceSeparator() throws Exception {
        SeparatorRenderer renderer = new DefaultHorizontalSeparatorRenderer(
                MCSMenuHorizontalSeparatorKeywords.SPACE);

        // Create expected
        String expected = " ";

View Full Code Here

    /**
     * This tests the functionality of the render method with a non breaking
     * space separator.
     */
    public void testRenderWithNonBreakingSpaceSeparator() throws Exception {
        SeparatorRenderer renderer = new DefaultHorizontalSeparatorRenderer(
                MCSMenuHorizontalSeparatorKeywords.NON_BREAKING_SPACE);

        // Create expected
        String expected = VolantisProtocol.NBSP;

View Full Code Here

    /**
     * Test the render method.
     */
    public void testRender() throws Exception {
        SeparatorRenderer renderer = new DefaultVerticalSeparatorRenderer(
                new TestDeprecatedLineBreakOutput());

        // Create expected
        String expected = DOMUtilities.provideDOMNormalizedString("<br/>");

        // Create the test buffer
        TestDOMOutputBuffer testBuffer = new TestDOMOutputBuffer();

        // Render using the test buffer
        renderer.render(testBuffer);

        // Extract the output from the rendering as a string.
        String actual = DOMUtilities.toString(testBuffer.getRoot());
        assertNotNull("The actual string should exist", actual);

View Full Code Here

     * This tests illegal separator renderer construction
     */
    public void testRenderIllegal() throws Exception {
        // Test null character string
        try {
            SeparatorRenderer renderer =
                    new DefaultCharacterMenuItemGroupSeparatorRenderer(null,
                                                                       1);
            fail("Construction of renderer should have been illegal (1)");
        } catch (IllegalArgumentException iae) {
            // Test was successfully if got here as the exception was thrown ;-)
        }

        // Test empty character string
        try {
            SeparatorRenderer renderer =
                    new DefaultCharacterMenuItemGroupSeparatorRenderer("",
                                                                       1);
            fail("Construction of renderer should have been illegal (1)");
        } catch (IllegalArgumentException iae) {
            // Test was successfully if got here as the exception was thrown ;-)
        }

        // Test negative repeats
        try {
            SeparatorRenderer renderer =
                    new DefaultCharacterMenuItemGroupSeparatorRenderer("*",
                                                                       -1);
            fail("Construction of renderer should have been illegal (2)");
        } catch (IllegalArgumentException iae) {
            // Test was successfully if got here as the exception was thrown ;-)
        }

        // Test zero repeats
        try {
            SeparatorRenderer renderer =
                    new DefaultCharacterMenuItemGroupSeparatorRenderer("*",
                                                                       0);
            fail("Construction of renderer should have been illegal (3)");
        } catch (IllegalArgumentException iae) {
            // Test was successfully if got here as the exception was thrown ;-)
View Full Code Here

     * This tests legal separator renderer construction
     */
    public void testRenderLegal() throws Exception {
        // Test one character, one repeat
        String charString = "*";
        SeparatorRenderer renderer =
                new DefaultCharacterMenuItemGroupSeparatorRenderer(charString,
                                                                   1);
        String expected = charString;
        testRenderer(renderer, expected);
    }
View Full Code Here

        // Test one character, one repeat - done in {@link #testRenderLegal}

        // Test one character, two repeats
        String charString = "*";
        SeparatorRenderer renderer =
                new DefaultCharacterMenuItemGroupSeparatorRenderer(charString,
                                                                   2);
        String expected = charString + charString;
        testRenderer(renderer, expected);

View Full Code Here

                                new TestSimpleMenuSeparatorRendererFactory()),
                        new AssetResolverMock("assetResolverMock", expectations),
                        new DefaultStylePropertyResolver(null, null));

        // Create the Renderers which will render the shard link Menu
        SeparatorRenderer orientationSeparator
                = menuSeparatorRendererSelector.selectMenuSeparator(menu);
        TestMenuBufferLocator locator
                = new TestMenuBufferLocator(orientationSeparator);

        MenuItemRendererSelector menuItemRendererSelector =
View Full Code Here

        this.styleResolver = styleResolver;
    }

    // javadoc inherited
    public SeparatorRenderer selectMenuSeparator(Menu menu) {
        SeparatorRenderer separator = null;

        // The properties that we're interested in are applied to the menu
        final PropertyValues properties =
                menu.getElementDetails().getStyles().getPropertyValues();
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.separator.SeparatorRenderer

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.