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

Examples of com.volantis.mcs.protocols.menu.shared.model.ConcreteElementDetails


     * @throws Exception
     */
    public void testBasics() throws Exception {

        // Create the menu item to test.
        ConcreteElementDetails elementDetails = createTestElementDetails();
        ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
       
        // Create the renderer we are to test.
        DefaultSpanMenuItemRenderer renderer =
View Full Code Here


     * @throws Exception if there was a problem rendering the menu item
     */
    public void testMCSAttributesAnnotatedWithStyles() throws Exception {

        // Create the menu item to test.
        ConcreteElementDetails elementDetails = createTestElementDetails();
        ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());

        // Create the renderer we are to test.
        DefaultSpanMenuItemRenderer renderer =
                new DefaultSpanMenuItemRenderer(
                        new TestDeprecatedSpanOutput());

        // Render.
        TestDOMOutputBuffer buffer = new TestDOMOutputBuffer();

        renderer.open(buffer, item);
        SpanAttributes attributes = (SpanAttributes)PrivateAccessor.
                getField(renderer, "attributes");
        assertNotNull("MCS Attributes should not be null", attributes);
        Styles styles = attributes.getStyles();

        assertNotNull("The Styles on the MCS Attributes must not be null",
                styles);
        assertEquals("The styles on the MCS Attributes must be the same " +
                "as the styles on the ElementDetails",
                elementDetails.getStyles(), styles);
    }
View Full Code Here

     * @param styles The styles which are applicable to this new element details
     * @return An ElementDetails
     */
    public ElementDetails createTestElementDetails(String element,
                                                   Styles styles) {
        ConcreteElementDetails elementDetails = new ConcreteElementDetails();
        elementDetails.setElementName(element);
        elementDetails.setStyles(styles);

        return elementDetails;
    }
View Full Code Here

     * @throws Exception
     */
    public void testNormal() throws Exception {

        // Create the menu item to test.
        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(
View Full Code Here

     * appropriate.
     */
    private ConcreteElementDetails createElementDetails(Styles styles) {

        // Create element details for the menu item using shard link style class.
        ConcreteElementDetails itemStyle = new ConcreteElementDetails();
        itemStyle.setStyles(styles);

        // Return the created and initialised style info
        return itemStyle;
    }
View Full Code Here

    // javadoc inherited
    public void startMenu() throws BuilderException {
        ConcreteMenu parent = getCurrentMenu();

        if (currentEntity == null) {
            push(new ConcreteMenu(new ConcreteElementDetails()));
        } else if (parent != null) {
            ConcreteMenu menu = new ConcreteMenu(new ConcreteElementDetails());
            parent.add(menu);
            push(menu);
        } else {
            reportBadParent(Menu.class);
        }
View Full Code Here

    public void startMenuGroup() throws BuilderException {
        ConcreteMenu parentMenu = getCurrentMenu();

        if (parentMenu != null) {
            ConcreteMenuItemGroup group = new ConcreteMenuItemGroup(
                    new ConcreteElementDetails());
            parentMenu.add(group);
            push(group);
        } else {
            reportBadParent(MenuItemGroup.class);
        }
View Full Code Here

        // May appear in menus or menu groups.
        // @todo later could use an interface common to the two target classes
        if (parentMenu != null) {
            ConcreteMenuItem item = new ConcreteMenuItem(
                    new ConcreteElementDetails(),
                    new ConcreteMenuLabel(
                            null,
                            new ConcreteMenuText()));
            parentMenu.add(item);
            push(item);
        } else {
            ConcreteMenuItemGroup parentGroup = getCurrentMenuItemGroup();

            if (parentGroup != null) {
                ConcreteMenuItem item = new ConcreteMenuItem(
                        new ConcreteElementDetails(),
                        new ConcreteMenuLabel(
                                null,
                                new ConcreteMenuText()));
                parentGroup.add(item);
                push(item);
View Full Code Here

        // May appear in menus or menu items (the latter always has one)
        // @todo later could use an interface common to the two target classes
        if (parentMenu != null) {
            ConcreteMenuLabel label = new ConcreteMenuLabel(
                    new ConcreteElementDetails(), new ConcreteMenuText());

            parentMenu.setLabel(label);
            push(label);
        } else {
            ConcreteMenuItem item = getCurrentMenuItem();
View Full Code Here

            throws BuilderException {

        AbstractModelElement modelElement = getCurrentModelElement();

        if (modelElement != null) {
            ConcreteElementDetails elementDetails =
                    (ConcreteElementDetails) modelElement.getElementDetails();

            if (elementDetails == null) {
                // Handle those cases where the element detas are optional
                elementDetails = new ConcreteElementDetails();

                modelElement.setElementDetails(elementDetails);
            }

            try {
                elementDetails.setElementName(elementName);
                elementDetails.setId(id);
                elementDetails.setStyles(styles);
            } catch (Exception e) {
                throw new BuilderException(e);
            }
        } else {
            reportBadParent("style");
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.menu.shared.model.ConcreteElementDetails

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.