Package org.apache.struts.config

Examples of org.apache.struts.config.FormPropertyConfig


        // Form Bean "dynamic2" is a DynaActionForm with the same properties
        formBean = new ActionFormBean
            ("dynamic2",
             "org.apache.struts.action.DynaActionForm");
        formBean.addFormPropertyConfig
            (new FormPropertyConfig("booleanProperty", "boolean", "false"));
        formBean.addFormPropertyConfig
            (new FormPropertyConfig("stringProperty", "java.lang.String",
                                    null));
        appConfig2.addFormBeanConfig(formBean);

        // Action "/dynamic2" uses the "dynamic2" form bean in session scope
        mapping = new ActionMapping();
View Full Code Here


        FormBeanConfig config =
            mapping.getModuleConfig().findFormBeanConfig(name);
        if (config == null) {
            return;
        }
        FormPropertyConfig props[] = config.findFormPropertyConfigs();
        for (int i = 0; i < props.length; i++) {
            set(props[i].getName(), props[i].initial());
        }

    }
View Full Code Here

        // Set the name we will know ourselves by from the form bean name
        this.name = config.getName();

        // Look up the property descriptors for this bean class
        FormPropertyConfig descriptors[] = config.findFormPropertyConfigs();
        if (descriptors == null) {
            descriptors = new FormPropertyConfig[0];
        }

        // Create corresponding dynamic property definitions
View Full Code Here

        FormBeanConfig config =
            mapping.getApplicationConfig().findFormBeanConfig(name);
        if (config == null) {
            return;
        }
        FormPropertyConfig props[] = config.findFormPropertyConfigs();
        for (int i = 0; i < props.length; i++) {
            set(props[i].getName(), props[i].initial());
        }

    }
View Full Code Here

            // ... and the property configs
            FormPropertyConfig[] fpcs = formBean.findFormPropertyConfigs();

            for (int j = 0; j < fpcs.length; j++) {
                FormPropertyConfig property = fpcs[j];

                if (property.getType() == null) {
                    handleValueRequiredException("type", property.getName(),
                        "form property");
                }
            }

            // Force creation and registration of DynaActionFormClass instances
View Full Code Here


    // Check for ability to add a property before and after freezing
    public void testConfigAdd() {

        FormPropertyConfig prop = null;

        // Before freezing
        prop = beanConfig.findFormPropertyConfig("fooProperty");
        assertNull("fooProperty not found", prop);
        beanConfig.addFormPropertyConfig
            (new FormPropertyConfig("fooProperty", "java.lang.String", ""));
        prop = beanConfig.findFormPropertyConfig("fooProperty");
        assertNotNull("fooProperty found", prop);

        // after freezing
        beanConfig.freeze();
        prop = beanConfig.findFormPropertyConfig("barProperty");
        assertNull("barProperty not found", prop);
        try {
            beanConfig.addFormPropertyConfig
                (new FormPropertyConfig("barProperty", "java.lang.String", ""));
            fail("barProperty add not prevented");
        } catch (IllegalStateException e) {
            ; // Expected result
        }
View Full Code Here


    // Check attempts to add a duplicate property name
    public void testConfigDuplicate() {

        FormPropertyConfig prop = null;
        assertNull("booleanProperty is found", prop);
        try {
            beanConfig.addFormPropertyConfig
                (new FormPropertyConfig("booleanProperty", "java.lang.String",
                                        ""));
            fail("Adding duplicate property not prevented");
        } catch (IllegalArgumentException e) {
            ; // Expected result
        }
View Full Code Here

    // Check the configured FormPropertyConfig element properties
    public void testConfigProperties() {

        for (int i = 0; i < dynaProperties.length; i++) {
            FormPropertyConfig dynaProperty =
                beanConfig.findFormPropertyConfig(dynaProperties[i].getName());
            assertNotNull("Found dynaProperty " +
                          dynaProperties[i].getName(), dynaProperty);
            assertEquals("dynaProperty name for " +
                         dynaProperties[i].getName(),
                         dynaProperties[i].getName(),
                         dynaProperty.getName());
            assertEquals("dynaProperty type for " +
                         dynaProperties[i].getName(),
                         dynaProperties[i].getType(),
                         dynaProperty.getType());
            assertEquals("dynaProperty initial for " +
                         dynaProperties[i].getName(),
                         dynaProperties[i].getInitial(),
                         dynaProperty.getInitial());
        }

    }
View Full Code Here


    // Check for ability to remove a property before and after freezing
    public void testConfigRemove() {

        FormPropertyConfig prop = null;

        // Before freezing
        prop = beanConfig.findFormPropertyConfig("booleanProperty");
        assertNotNull("booleanProperty found", prop);
        beanConfig.removeFormPropertyConfig(prop);
View Full Code Here

        throws IllegalAccessException, InstantiationException {

        DynaActionForm dynaBean =
            (DynaActionForm) getBeanClass().newInstance();
        dynaBean.setDynaActionFormClass(this);
        FormPropertyConfig props[] = config.findFormPropertyConfigs();
        for (int i = 0; i < props.length; i++) {
            dynaBean.set(props[i].getName(), props[i].initial());
        }
        return (dynaBean);
View Full Code Here

TOP

Related Classes of org.apache.struts.config.FormPropertyConfig

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.