Examples of MenuModelBuilder


Examples of com.volantis.mcs.protocols.menu.builder.MenuModelBuilder

             */
            protected void setUp(MarinerPageContext pageContext)
                    throws Exception {
                // Now set up an appropriate context within the Menu Model and
                // the page context
                MenuModelBuilder builder = pageContext.getMenuBuilder();
                VolantisProtocol protocol = pageContext.getProtocol();
                originalBuffer = protocol.getOutputBufferFactory().
                        createOutputBuffer();
                builder.startMenu();

                pageContext.pushOutputBuffer(originalBuffer);

                assertSame("current output buffer not as expected",
                           originalBuffer,
View Full Code Here

Examples of com.volantis.mcs.protocols.menu.builder.MenuModelBuilder

        deviceLayoutContext.setFormatInstance(testPane,
                NDimensionalIndex.ZERO_DIMENSIONS, paneInstance);
        pageContext.pushDeviceLayoutContext(deviceLayoutContext);
        pageContext.setFormatInstance(paneInstance);

        MenuModelBuilder menuModelBuilder = pageContext.getMenuBuilder();
        //builder#startMenuGroup will fail unless this has been called
        menuModelBuilder.startMenu();

        // set up protocol attributes
        MenuItemGroupAttributes menuItemGroupAttrs =
                new MenuItemGroupAttributes();
        menuItemGroupAttrs.setPane(pane);
View Full Code Here

Examples of com.volantis.mcs.protocols.menu.builder.MenuModelBuilder

        if (groupStyles == null) {
            groupStyles = StylesBuilder.getInitialValueStyles();
        }

        MenuModelBuilder builder = new ConcreteMenuModelBuilder();
        builder.startMenu();
        builder.setElementDetails("menu", "menu1", menuStyles);
        builder.startMenuGroup();
        builder.setElementDetails("menugroup", "menugroup1", groupStyles);

        if (groupPane != null) {
            builder.setPane(groupPane);
        }

        builder.startMenuItem();
        builder.setElementDetails("menuitem", "menuitem1",
                StylesBuilder.getInitialValueStyles());
        builder.startLabel();
        builder.startIcon();
        builder.setNormalImageURL(new LiteralImageAssetReference("normal.gif"));
        builder.setOverImageURL(new LiteralImageAssetReference("over.gif"));
        builder.endIcon();
        builder.startText();

        OutputBuffer buffer = new TestDOMOutputBuffer();
        buffer.writeText("text");

        builder.setText(buffer);
        builder.endText();
        builder.endLabel();
        builder.setHref(new LiteralLinkAssetReference("href.xml"));
        builder.endMenuItem();
        builder.endMenuGroup();
        builder.endMenu();

        return builder.getCompletedMenuModel();
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.menu.builder.MenuModelBuilder

                "mcs-menu-image-style: rollover");
        PrivateAccessor.setField(menuElement, "menuProperties",
                testStyles.getPropertyValues());
        pageContext.pushElement(menuElement);

        MenuModelBuilder menuModelBuilder = pageContext.getMenuBuilder();
        //builder#startMenuItem will fail unless this has been called
        menuModelBuilder.startMenu();

        MenuItemAttributes menuItemAttrs = createAttributes();
        int result = element.elementStart(requestContext, menuItemAttrs);

        assertTrue("Unexpected value returned from MenuItemElement.  Should " +
View Full Code Here

Examples of com.volantis.mcs.protocols.menu.builder.MenuModelBuilder

                ContextInternals.getMarinerPageContext(context);

        // Pop this element
        pageContext.popElement(this);

        MenuModelBuilder builder = pageContext.getMenuBuilder();

        try {
            Menu menu = builder.endMenu();

            // If a menu is completed (i.e. this is not nested) then need to
            // process it and output against specific renderer and markup.
            if (menu != null) {
                // Obtain a suitable renderer
View Full Code Here

Examples of com.volantis.mcs.protocols.menu.builder.MenuModelBuilder

                ContextInternals.getMarinerPageContext(context);

        MenuAttributes attributes = (MenuAttributes) blockAttributes;

        // Get hold of the menu builder - this will be initialised if needed
        MenuModelBuilder builder = pageContext.getMenuBuilder();

        try {
            // Starting a new menu
            builder.startMenu();

            // Setting attributes on the menu

            // Set the pane attribute
            MenuInternals.setPane(builder, attributes.getPane(), pageContext);

            // Get the styling property values for the current element
            Styles styles = pageContext.getStylingEngine().getStyles();

            // Emulate deprecated menu styles if necessary
            useDeprecatedMenuTypes(styles, attributes.getType());

            // Store the propertyvalues for any child use
            menuProperties = styles.getPropertyValues();

            // Set the stylistic information in the model for this element.
            MenuInternals.setElementDetails(builder, attributes, styles);

            // Set the event handling
            MenuInternals.setEvents(builder, attributes, pageContext);

            PolicyReferenceResolver resolver =
                    pageContext.getPolicyReferenceResolver();

            // Set the prompt
            builder.setPrompt(resolver.resolveQuotedTextExpression(
                    attributes.getPrompt()));

            // Set the error message
            builder.setErrorMessage(resolver.resolveQuotedTextExpression(
                    attributes.getErrmsg()));

            // Set the help
            builder.setHelp(resolver.resolveQuotedTextExpression(
                    attributes.getHelp()));

            // Set the title
            builder.setTitle(attributes.getTitle());

            // Set the Shortcut properties.
            setShortcutPropertiesOnBuilder(pageContext, builder, styles);

            // Push this element
View Full Code Here

Examples of com.volantis.mcs.protocols.menu.builder.MenuModelBuilder

                ContextInternals.getMarinerPageContext(context);

        MenuItemGroupAttributes attributes =
                (MenuItemGroupAttributes) baseAttributes;

        MenuModelBuilder builder = pageContext.getMenuBuilder();

        try {
            // Retrive the pane name...
            String paneName = attributes.getPane();

            // Emulating behaviour for BlockAttributes and panes
            if (paneName != null) {
                // Try and find the pane with the specified name, if it could
                // not be found then return and skip the element body.
                FormatReference formatRef =
                        FormatReferenceParser.parsePane(paneName, pageContext);
                Pane pane = pageContext.getPane(formatRef.getStem());

                if (pane == null) {
                    skipped = true;
                    return SKIP_ELEMENT_BODY;
                }
            }

            // Start a new menu group
            builder.startMenuGroup();

            // Setting attributes on the menu group

            // Set the pane attribute
            MenuInternals.setPane(builder, paneName, pageContext);
View Full Code Here

Examples of com.volantis.mcs.protocols.menu.builder.MenuModelBuilder

        if (!skipped) {
            // Only want to do this is the element start did not skip processing
            MarinerPageContext pageContext =
                    ContextInternals.getMarinerPageContext(context);

            MenuModelBuilder builder = pageContext.getMenuBuilder();

            try {
                // End the existing menu group
                builder.endMenuGroup();
            } catch (BuilderException be) {
                logger.error("menu-building-error", be);
                throw new PAPIException(
                        exceptionLocalizer.format("menu-building-error"), be);
            }
View Full Code Here

Examples of com.volantis.mcs.protocols.menu.builder.MenuModelBuilder

        Styles styles = pageContext.getStylingEngine().getStyles();

        processMenuItemStyles(attributes, styles);

        MenuModelBuilder builder = pageContext.getMenuBuilder();

        try {
            // Start a new menu item
            builder.startMenuItem();

            // Start a new menu label
            builder.startLabel();

            // Start a new menu text
            builder.startText();

            // Set the text by constructing an artificial output buffer from
            // the text attribute
            // NB: The allocation mechanism must be compatible with the
            //     de-allocation mechanism used in
            //     {@link MenuElement#releaseLabelOutputBuffers}
            OutputBuffer text = pageContext.getProtocol().
                    getOutputBufferFactory().createOutputBuffer();
            text.writeText(attributes.getText());
            builder.setText(text);

            // End the menu text
            builder.endText();

            // OK, get the attributes from PAPI
            String onImage = attributes.getOnImage();
            String offImage = attributes.getOffImage();
            String rolloverImage = attributes.getRolloverImage();
            String image = attributes.getImage();

            // Set the normal (on) and over (off) images
            setNormalAndOverImages(pageContext, onImage, offImage,
                    rolloverImage, image);

            // Create the menu icon on the builder
            if (normal != null) {
                // Start a new menu icon
                builder.startIcon();

                // Set the values
                builder.setNormalImageURL(normal);
                if (over != null) {
                    builder.setOverImageURL(over);
                }

                // End the menu icon
                builder.endIcon();
            }

            // End the menu label;
            builder.endLabel();

            // Set the stylistic information in the model for this element.
            MenuInternals.setElementDetails(builder, attributes,
                    styles);

            // Set the segment
            builder.setSegment(attributes.getSegment());

            // Set the target
            builder.setTarget(attributes.getTarget());

            // Set the event handling
            MenuInternals.setEvents(builder, attributes, pageContext);

            // Set the pane attribute
            MenuInternals.setPane(builder, attributes.getPane(), pageContext);

            // Initialise the attributes specific to this field.
            String accessKey = attributes.getAccessKey();
            String shortcut = attributes.getShortcut();

            if (shortcut != null) {
                if (accessKey != null) {
                    throw new PAPIException(exceptionLocalizer.
                            format(
                            "menu-building-shortcut-and-accesskey-error"));
                }
            } else {
                shortcut = accessKey;
            }

            PolicyReferenceResolver resolver =
                    pageContext.getPolicyReferenceResolver();

            // Process the shortcut
            TextAssetReference shortcutObj =
                    resolver.resolveQuotedTextExpression(shortcut);
            builder.setShortcut(shortcutObj);

            //Process the href as a mariner expression
            LinkAssetReference href = resolver.resolveQuotedLinkExpression(
                    attributes.getHref(), PageURLType.MENU_ITEM);
            builder.setHref(href);

            // Process the prompt as a mariner expression
            TextAssetReference prompt = resolver.resolveQuotedTextExpression(
                    attributes.getPrompt());
            builder.setPrompt(prompt);

            // Set the title.
            builder.setTitle(attributes.getTitle());

        } catch (BuilderException be) {
            logger.error("menu-building-error", be);
            throw new PAPIException(
                    exceptionLocalizer.format("menu-building-error"), be);
View Full Code Here

Examples of com.volantis.mcs.protocols.menu.builder.MenuModelBuilder

            throws PAPIException {

        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);

        MenuModelBuilder builder = pageContext.getMenuBuilder();

        try {
            // End the existing menu item
            builder.endMenuItem();
        } catch (BuilderException be) {
            logger.error("menu-building-error", be);
            throw new PAPIException(
                    exceptionLocalizer.format("menu-building-error"), be);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.