Package com.volantis.mcs.protocols.menu.model

Examples of com.volantis.mcs.protocols.menu.model.MenuLabel


     */
    public void testLabel() {
        ConcreteMenu item = MenuModelHelper.createMenu(false, testTitle);

        // Test getting a null label
        MenuLabel testLabel = item.getLabel();
        assertNull("Should be no label", testLabel);

        // Test setting label
        MenuLabel label = MenuModelHelper.createMenuLabel(null);
        item.setLabel(label);

        // Test getting a non-null label
        testLabel = item.getLabel();
        assertNotNull("Should be a label", testLabel);
View Full Code Here


    }

    public MenuItemRenderedContent render(OutputBuffer buffer, MenuItem item)
        throws RendererException {

        MenuLabel label = item.getLabel();
        MenuIcon icon = label.getIcon();
        ElementDetails elementDetails = icon.getElementDetails();
        Styles styles = null;
        if (elementDetails != null) {
            styles = elementDetails.getStyles();
        }
View Full Code Here

     */
    public void testLabel() {
        ConcreteMenuItem item = MenuModelHelper.createMenuItem(itemName);

        // Test getting a null label
        MenuLabel testLabel = item.getLabel();
        assertNotNull("Should be a default label", testLabel);

        // Test setting label
        MenuLabel label = MenuModelHelper.createMenuLabel(null);
        item.setLabel(label);

        // Test getting a non-null label
        testLabel = item.getLabel();
        assertNotNull("Should be a label", testLabel);
View Full Code Here

     */
    public static ConcreteMenuItem createMenuItem(OutputBuffer itemName) {
        ConcreteMenuText text =
                new ConcreteMenuText(createElementDetails());
        text.setText(itemName);
        MenuLabel label = new ConcreteMenuLabel(createElementDetails(), text);
        return new ConcreteMenuItem(createElementDetails(), label);
    }
View Full Code Here

                Menu menu = pageContext.getMenuBuilder().endMenu();

                assertNotNull("the menu model should be complete",
                              menu);

                MenuLabel label = menu.getLabel();

                assertNotNull("the menu label should exist",
                              label);

                assertEquals("pane not as",
                             PANE,
                             label.getPane().getStem());

                assertSame("output buffers not same",
                           pageContext.getCurrentOutputBuffer(),
                           label.getText().getText());

                assertEquals("title not as",
                             TITLE,
                             label.getTitle());

                assertEquals("onclick not as",
                             ON_CLICK,
                             label.getEventHandler(EventType.ON_CLICK).getScript());

                ElementDetails menuElementDetails = menu.getElementDetails();
                // if element details are not null, styles should be non null
                assertNotNull("Menu ElementDetails should not be null",
                        menuElementDetails);
                assertNotNull("Menu Styles should not be null",
                        menuElementDetails.getStyles());

                ElementDetails elementDetails = label.getElementDetails();
                assertNotNull("Label ElementDetails should not be null",
                        elementDetails);
                assertNotNull("Styles should not be null after " +
                        "LabelElement#elementStart",
                        elementDetails.getStyles());
View Full Code Here

    public void testGetText() {
        ElementDetails elementDetails = MenuModelHelper.createElementDetails();
        ConcreteMenuText text = new ConcreteMenuText(elementDetails);
        ConcreteMenuIcon icon = new ConcreteMenuIcon(elementDetails);

        MenuLabel label;
        text.setText(testText);
        icon.setNormalURL(testIcon);

        // Test illegal configurations
        try {
            label = createTestInstance(MenuModelHelper.createElementDetails(),
                                       null,
                                       null);
            fail("The creation of a class should have caused an exception");
        } catch (IllegalArgumentException iae) {
            // Test passes - exception gets thrown :-)
        }

        try {
            label = createTestInstance(MenuModelHelper.createElementDetails(),
                                       null,
                                       icon);
            fail("The creation of a class should have caused an exception");
        } catch (IllegalArgumentException iae) {
            // Test passes - exception gets thrown :-)
        }

        // Test legal configuration
        text.setText(testText);
        label = createTestInstance(MenuModelHelper.createElementDetails(),
                                   text,
                                   icon);
        MenuText testMenuText = label.getText();
        assertNotNull("Menu text should not be null", testMenuText);
        assertEquals("The menu texts should be the same", text, testMenuText);

        // Test method
        OutputBuffer secondTestText = new DOMOutputBuffer();
        ConcreteMenuText secondText = new ConcreteMenuText(elementDetails);
        secondText.setText(secondTestText);

        ((ConcreteMenuLabel)label).setText(secondText);
        testMenuText = label.getText();
        assertNotNull("Menu text should not be null", testMenuText);
        assertEquals("The menu texts should be the same",
                secondText, testMenuText);
    }
View Full Code Here

    /**
     * Tests the getIcon method using various null configurations and als the
     * get/set method combinations.
     */
    public void testGetIcon() {
        MenuLabel label;

        // Test non-null configuration
        label = createTestInstance(null, true);
        MenuIcon testIcon = label.getIcon();
        assertNotNull("Icon should not be null", testIcon);

        // Test null configuration
        label = createTestInstance(null, false);
        testIcon = label.getIcon();
        assertNull("Icon should be null", testIcon);

        // Test method
        ElementDetails elementDetails = MenuModelHelper.createElementDetails();
        MenuIcon icon = new ConcreteMenuIcon(elementDetails);

        ((ConcreteMenuLabel)label).setIcon(icon);
        testIcon = label.getIcon();
        assertNotNull("Icon should not be null", testIcon);
        assertEquals("Icons should be the same", icon, testIcon);

        ImageAssetReference secondIconReference =
                new TestNormalImageAssetReference("another icon reference");
        ConcreteMenuIcon secondIcon = new ConcreteMenuIcon(elementDetails);
        secondIcon.setNormalURL(secondIconReference);

        ((ConcreteMenuLabel)label).setIcon(secondIcon);
        testIcon = label.getIcon();
        assertNotNull("Icon should not be null", testIcon);
        assertEquals("Icons should be the same", secondIcon, testIcon);
    }
View Full Code Here

    }

    public MenuItemRenderedContent render(OutputBuffer buffer, MenuItem item)
        throws RendererException {

        MenuLabel label = item.getLabel();
        MenuIcon icon = label.getIcon();
        ElementDetails elementDetails = icon.getElementDetails();
        Styles styles = null;
        if (elementDetails != null ) {
            styles = elementDetails.getStyles();
        }
View Full Code Here

        b.addTail(textElement);
        textBuffer.addElement(b);

        // Create the test text, label, and then the menu item
        MenuText text = entity.createTestMenuText(textBuffer);
        MenuLabel label = entity.createTestMenuLabel(text);
        MenuItem item = entity.createTestMenuItem(label);

        // Create test renderer object
        DefaultPlainTextMenuItemRenderer renderer =
                new DefaultPlainTextMenuItemRenderer();
View Full Code Here

    private Element lastElement;

    public MenuItemRenderedContent render(OutputBuffer buffer, MenuItem item)
        throws RendererException {

        MenuLabel label = item.getLabel();
        MenuText text = label.getText();
        ElementDetails elementDetails = text.getElementDetails();
        Styles styles = null;
        if (elementDetails != null) {
            styles = elementDetails.getStyles();
        }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.menu.model.MenuLabel

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.