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

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


        menu = builder.endMenu();

        final Map buffers = new HashMap();

        MenuModelVisitor setupMapVisitor = new AbstractMenuModelHandler() {
            // javadoc inherited
            protected boolean handle(MenuItem item) {
                buffers.put(item, locator.getMenuBuffer(item));

                return false;
            }

            // javadoc inherited
            protected boolean handle(MenuItemGroup group) {
                buffers.put(group, locator.getMenuBuffer(group));

                return true;
            }

            // javadoc inherited
            protected boolean handle(Menu menu) {
                buffers.put(menu, locator.getMenuBuffer(menu));

                return true;
            }
        };

        setupMapVisitor.visit(menu);

        MenuModelVisitor checkVisitor = new AbstractMenuModelHandler() {
            // javadoc inherited
            protected boolean handle(MenuItem item) {
                assertSame("item's buffer not as",
                           buffers.get(item),
                           locator.getMenuBuffer(item));

                return true;
            }

            // javadoc inherited
            protected boolean handle(MenuItemGroup group) {
                assertSame("group's buffer not as",
                           buffers.get(group),
                           locator.getMenuBuffer(group));

                return true;
            }

            // javadoc inherited
            protected boolean handle(Menu menu) {
                assertSame("menu's buffer not as",
                           buffers.get(menu),
                           locator.getMenuBuffer(menu));

                return false;
            }
        };

        checkVisitor.visit(menu);

        assertSame("menu and first child should share same buffer",
                   buffers.get(menu),
                   buffers.get(menu.get(0)));
View Full Code Here


        public void render(Menu menu)
                throws RendererException {

            renderCount++;
            // Test menu access
            MenuModelVisitor visitor = new SimpleAbstractMenuModelVisitor();

            try {
                visitor.visit(menu);
            } catch (MenuModelVisitorException e) {
                throw new RendererException(e);
            }
        }
View Full Code Here

TOP

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

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.