Package com.googlecode.wicketwebbeans.model

Examples of com.googlecode.wicketwebbeans.model.BeanMetaData


        tester.startPage(BeanMetaDataTestPage.class);
        Page page = tester.getLastRenderedPage();
       
        BeanMetaDataTestBean bean = new BeanMetaDataTestBean();
        // Use the "view" context
        BeanMetaData beanMetaData = new BeanMetaData(BeanMetaDataTestBean.class, "view", page, null, false);
        // Check parameters, elements, element parameters, tabs, tab elements.
        assertTrue( beanMetaData.isViewOnly() );
        assertTrue( beanMetaData.isDisplayed() );
        assertEquals("Bean View", beanMetaData.getLabel() );
       
        ElementInfo[] expectedProps = {
            new ElementInfo("action.addRow", true, null, null, "Add Row", null, "listOfBeans"),
            new ElementInfo("action.save", true, null, null, "Save", null, "nameInfo"),
            new ElementInfo("gender", true, null, null, "Gender", null, "miscInfo"),
            new ElementInfo("beans", true, null, null, "Beans", null, "listOfBeans"),
            // firstName was explicitly overridden as not viewOnly.
            new ElementInfo("firstName", false, null, null, "First Name", null, "nameInfo"),
            new ElementInfo("EMPTY:28", true, EmptyField.class.getName(), null, "", null, "miscInfo"),
            new ElementInfo("age", true, null, null, "Age", null, "miscInfo"),
            new ElementInfo("lastName", true, null, null, "Last Name", null, "nameInfo"),
            new ElementInfo("operand1", true, null, null, "Operand 1", null, "miscInfo"),
            new ElementInfo("EMPTY:28", true, EmptyField.class.getName(), null, "", null, "nameInfo"),
            new ElementInfo("activePrimitive", true, null, null, "Active Primitive", null, "nameInfo"),
            new ElementInfo("operand2", true, null, null, "Operand 2", null, "miscInfo"),
            new ElementInfo("color", true, null, null, "Color", null, "nameInfo"),
            new ElementInfo("result", true, null, null, "Result", null, "miscInfo"),
            new ElementInfo("inlineBean", true, BeanInlineField.class.getName(), null, "Inline Bean", null, "nameInfo"),
            new ElementInfo("palette", true, null, BeanMetaDataTestBean.ColorEnum.class.getName(), "Palette", null, "miscInfo"),
            new ElementInfo("dateTimestamp", true, null, null, "Date Timestamp", null, "nameInfo"),
            new ElementInfo("blockBean", true, BeanGridField.class.getName(), null, "Block Bean", null, "nameInfo"),
            new ElementInfo("description", true, TextAreaField.class.getName(), null, "Description", null, "miscInfo"),
            new ElementInfo("testBean2", true, null, null, "Test Bean 2", null, "nameInfo"),
            new ElementInfo("popupBean", true, null, null, "Popup Bean", null, "nameInfo"),
            new ElementInfo("action.cancel", true, null, null, "Cancel", null, null),
            new ElementInfo("action.doIt", true, null, null, "Do It", null, null),
            new ElementInfo("dateOnly", true, null, null, "Date Only", null, "nameInfo"),
            new ElementInfo("isActive", true, null, null, "Is Active", null, "nameInfo"),
            new ElementInfo("savingsAmount", true, null, null, "Savings Amount", null, "nameInfo"),
            new ElementInfo("startDate", true, null, null, "Start Date", null, "nameInfo"),
            new ElementInfo("timeOnly", true, null, null, "Time Only", null, "nameInfo"),
        };

        assertEquals(expectedProps.length, beanMetaData.getDisplayedElements().size());
       
        int elementIdx = 0;
        for (ElementMetaData element : beanMetaData.getDisplayedElements()) {
            //System.out.println("new ElementInfo(\"" + element.getPropertyName() + "\", " + element.isViewOnly() + ", \"" + element.getFieldType() + "\", \"" + element.getElementTypeName() + "\", \"" + element.getLabel() + "\", \"" + element.getLabelImage() + "\", \"" + element.getTabId() + "\"),");
            assertElement(beanMetaData, element, expectedProps[elementIdx]);
            ++elementIdx;
        }
       
        // action.save (second element) should have a parameter of colspan: 4
        assertEquals(Integer.valueOf(4), beanMetaData.getDisplayedElements().get(1).getIntegerParameter("colspan"));
       
        List<TabMetaData> tabs = beanMetaData.getTabs();
        assertEquals(3, tabs.size());
       
        assertEquals("nameInfo", tabs.get(0).getId());
        assertEquals("Name Info", tabs.get(0).getLabel());
        assertEquals(16, beanMetaData.getTabElements(tabs.get(0)).size());
       
        assertEquals("miscInfo", tabs.get(1).getId());
        assertEquals("Miscellaneous", tabs.get(1).getLabel());
        assertEquals(8, beanMetaData.getTabElements(tabs.get(1)).size());
       
        assertEquals("listOfBeans", tabs.get(2).getId());
        assertEquals("List Of Beans", tabs.get(2).getLabel());
        assertEquals(2, beanMetaData.getTabElements(tabs.get(2)).size());
    }
View Full Code Here


        tester.startPage(BeanMetaDataTestPage.class);
        Page page = tester.getLastRenderedPage();
       
        BeanMetaDataTestBean bean = new BeanMetaDataTestBean();
        // Use the "popupView" context
        BeanMetaData beanMetaData = new BeanMetaData(BeanMetaDataTestBean.class, "popupView", page, null, false);
        // Check parameters, elements, element parameters, tabs, tab elements.
        assertTrue( beanMetaData.isViewOnly() );
        assertTrue( beanMetaData.isDisplayed() );
        assertEquals("Bean Popup View", beanMetaData.getLabel() );
       
        ElementInfo[] expectedProps = {
            new ElementInfo("action.addRow", true, null, null, "Add Row", null, "listOfBeans"),
            new ElementInfo("action.save", true, null, null, "Save", null, "nameInfo"),
            new ElementInfo("gender", true, null, null, "Gender", null, "miscInfo"),
            new ElementInfo("beans", true, null, null, "Beans", null, "listOfBeans"),
            // firstName was explicitly overridden as not viewOnly.
            new ElementInfo("firstName", false, null, null, "First Name", null, "nameInfo"),
            new ElementInfo("EMPTY:28", true, EmptyField.class.getName(), null, "", null, "miscInfo"),
            new ElementInfo("age", true, null, null, "Age", null, "miscInfo"),
            new ElementInfo("lastName", false, null, null, "Last Name", null, "nameInfo"),
            new ElementInfo("operand1", true, null, null, "Operand 1", null, "miscInfo"),
            new ElementInfo("EMPTY:28", true, EmptyField.class.getName(), null, "", null, "nameInfo"),
            new ElementInfo("activePrimitive", true, null, null, "Active Primitive", null, "nameInfo"),
            new ElementInfo("operand2", true, null, null, "Operand 2", null, "miscInfo"),
            new ElementInfo("result", true, null, null, "Result", null, "miscInfo"),
            new ElementInfo("inlineBean", true, BeanInlineField.class.getName(), null, "Inline Bean", null, "nameInfo"),
            new ElementInfo("palette", true, null, BeanMetaDataTestBean.ColorEnum.class.getName(), "Palette", null, "miscInfo"),
            new ElementInfo("dateTimestamp", true, null, null, "Date Timestamp", null, "nameInfo"),
            new ElementInfo("blockBean", true, BeanGridField.class.getName(), null, "Block Bean", null, "nameInfo"),
            new ElementInfo("description", true, TextAreaField.class.getName(), null, "Description", null, "miscInfo"),
            new ElementInfo("testBean2", true, null, null, "Test Bean 2", null, "nameInfo"),
            new ElementInfo("popupBean", true, null, null, "Popup Bean", null, "nameInfo"),
            new ElementInfo("action.cancel", true, null, null, "Cancel", null, null),
            new ElementInfo("action.doIt", true, null, null, "Do It", null, null),
            new ElementInfo("dateOnly", true, null, null, "Date Only", null, "nameInfo"),
            new ElementInfo("isActive", true, null, null, "Is Active", null, "nameInfo"),
            new ElementInfo("savingsAmount", true, null, null, "Savings Amount", null, "nameInfo"),
            new ElementInfo("startDate", true, null, null, "Start Date", null, "nameInfo"),
            new ElementInfo("timeOnly", true, null, null, "Time Only", null, "nameInfo"),
        };

        assertEquals(expectedProps.length, beanMetaData.getDisplayedElements().size());
       
        int elementIdx = 0;
        for (ElementMetaData element : beanMetaData.getDisplayedElements()) {
            //System.out.println("new ElementInfo(\"" + element.getPropertyName() + "\", " + element.isViewOnly() + ", \"" + element.getFieldType() + "\", \"" + element.getElementTypeName() + "\", \"" + element.getLabel() + "\", \"" + element.getLabelImage() + "\", \"" + element.getTabId() + "\"),");
            assertElement(beanMetaData, element, expectedProps[elementIdx]);
            ++elementIdx;
        }
       
        // action.save (second element) should have a parameter of colspan: 4
        assertEquals(Integer.valueOf(4), beanMetaData.getDisplayedElements().get(1).getIntegerParameter("colspan"));
       
        List<TabMetaData> tabs = beanMetaData.getTabs();
        assertEquals(3, tabs.size());
       
        assertEquals("nameInfo", tabs.get(0).getId());
        assertEquals("Name Info", tabs.get(0).getLabel());
        assertEquals(15, beanMetaData.getTabElements(tabs.get(0)).size());
       
        assertEquals("miscInfo", tabs.get(1).getId());
        assertEquals("Miscellaneous", tabs.get(1).getLabel());
        assertEquals(8, beanMetaData.getTabElements(tabs.get(1)).size());
       
        assertEquals("listOfBeans", tabs.get(2).getId());
        assertEquals("List Of Beans", tabs.get(2).getLabel());
        assertEquals(2, beanMetaData.getTabElements(tabs.get(2)).size());
    }
View Full Code Here

        tester.startPage(BeanMetaDataTestPage.class);
        Page page = tester.getLastRenderedPage();
       
        BeanMetaDataTestBean bean = new BeanMetaDataTestBean();
        try {
            BeanMetaData beanMetaData = new BeanMetaData(BeanMetaDataTestBean.class, "missingContext", page, null, false);
            fail("Expected exception on missing context");
        }
        catch (RuntimeException e) {
            // Expected.
        }
View Full Code Here

TOP

Related Classes of com.googlecode.wicketwebbeans.model.BeanMetaData

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.