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

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


         ConcreteMenu itemGroup = MenuModelHelper.createMenu(true, testTitle);

         int maxItems = itemGroup.getSize();

         // Test get within bounds
         MenuEntry item = itemGroup.get(1);
         assertNotNull("Menu item should not be null", item);

         // Test get out of bounds
         try {
             item = itemGroup.get(maxItems + 1);
View Full Code Here


     */
    public void testGetContainer() {
        AbstractMenuEntry testClass = (AbstractMenuEntry) createTestInstance();

        // Test null values
        MenuEntry parentObject = null;
        testClass.setContainer(parentObject);
        MenuEntry testObject = testClass.getContainer();

        assertNull("The test object should be null", testObject);
        assertEquals("The parent and test objects should be the same",
                parentObject, testObject);

View Full Code Here

    // JavaDoc inherited
    public void testGetContainer() {
        AbstractMenuEntry testClass = (AbstractMenuEntry) createTestInstance();

        // Test null values
        MenuEntry parentObject = null;
        try {
            testClass.setContainer(parentObject);
            fail("The set should throw an exception as no menu parent");
        } catch (IllegalStateException ise) {
            // Test passed as the exception was thrown as expected
        }

        // Test non-null values;
        parentObject = MenuModelHelper.createMenu(false, null);
        testClass.setContainer(parentObject);
        MenuEntry testObject = testClass.getContainer();

        assertNotNull("The test object should not be null", testObject);
        assertEquals("The parent and test objects should be the same",
                parentObject, testObject);
    }
View Full Code Here

        // with the initial iteration associated with the menu
        FormatReference allocation = menu.getPane();

        try {
            for (int i = 0; i < menu.getSize(); i++) {
                MenuEntry child = menu.get(i);

                if (child.getPane() == null) {
                    int[] indices;

                    // Store the current iteration for this child then set up
                    // the next iteration
                    getAllocations().put(child, allocation);
View Full Code Here

        // menu items themselves).

        // This code assumes that the buffers contain plain
        // text
        Menu menu = (Menu)group.getContainer();
        MenuEntry entry;
        DOMOutputBuffer buffer;
        Text text;
        int max = 0;
        int len;
View Full Code Here

     */
    private boolean checkNestedPanes(FormatReference pane) {
        boolean success = true;

        if (menu != null) {
            MenuEntry currentMenu = menu.getContainer();
            while (currentMenu != null) {
                FormatReference ref = currentMenu.getPane();
                if (ref != null && ref.getStem().equals(pane.getStem())) {
                    // fail the check
                    success = false;
                    logger.warn("menu-target-warning", new Object[]{pane});
                }
                currentMenu = currentMenu.getContainer();
            }
        }

        // No real need to return a value at the moment as a warning is just
        // logged but in future there may be a need to check whether anything
View Full Code Here

     * (if any) to discover the containing menu item.  If there is null parent
     * this will throw an IllegalStateException because this situation should
     * never occur.
     */
    private void findMenu() {
        MenuEntry parent = getContainer();
        while (parent != null && !(parent instanceof Menu)) {
            parent = parent.getContainer();
        }
        if (parent == null) {
            throw new IllegalStateException(
                "Menu items must appear directly or indirectly within a menu");
        }
View Full Code Here

     */
    public boolean isParentAutoIterating(Menu menu) {
        boolean result = false;

        // Check the containing item if it is a menu
        MenuEntry parent = menu.getContainer();
        if (parent != null && (parent instanceof Menu)) {
            result = isAutoIterationAllocating((Menu)parent);
        }

        return result;
View Full Code Here

     * visting the children.
     */
    public void renderChildren(Menu menu) throws RendererException {
        int numChildren = menu.getSize();
        for (int i = 0; i < numChildren; i++) {
            MenuEntry menuItem = menu.get(i);
            accept(menuItem);
        }
    }
View Full Code Here

TOP

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

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.