Package org.springframework.binding.support

Examples of org.springframework.binding.support.TestBean


        tb = (JToggleButton) tbb.getControl();
        return "booleanProperty";
    }

    public void testInitialValue() {
        TestBean bean = new TestBean();
        bean.setBooleanProperty(true);
        FormModel fm = new DefaultFormModel(bean);
        ToggleButtonBinding binding = new ToggleButtonBinding(new JToggleButton(), fm, "booleanProperty");
        JToggleButton control = (JToggleButton) binding.getControl();
        assertEquals(true, control.isSelected());
    }
View Full Code Here


    protected AbstractFormModel getFormModel(BeanPropertyAccessStrategy pas, boolean buffering) {
        return new TestDefaultFormModel(pas, buffering);
    }

    public void testPropertyChangeCausesValidation() {
        DefaultFormModel fm = (DefaultFormModel) getFormModel(new TestBean());
        TestValidator v = new TestValidator();
        fm.setValidator(v);
        TestConversionService cs = new TestConversionService();
        cs.executer = new ConversionExecutor(String.class, String.class, new CopiedPublicNoOpConverter(String.class, String.class));
        fm.setConversionService(cs);
View Full Code Here

        vm.setValue("2");
        assertEquals(expectedCount++, v.count);
    }

    public void testValidationMessages() {
      DefaultFormModel fm = (DefaultFormModel) getFormModel(new TestBean());
        ValidationResultsModel r = fm.getValidationResults();
        TestValidator v = new TestValidator();
        fm.setValidator(v);
        ValueModel vm = fm.getValueModel("simpleProperty");
        // starting at 2: constructing a formmodel + creating valueModel
View Full Code Here

        assertEquals(1, r.getMessageCount());
        assertContainsMessage("message2", r.getMessages());
    }

    public void testRaiseClearValidationMessage() {
      DefaultFormModel fm = (DefaultFormModel) getFormModel(new TestBean());
        ValidationResultsModel r = fm.getValidationResults();
        TestValidator v = new TestValidator();
        fm.setValidator(v);
        ValueModel vm = fm.getValueModel("simpleProperty");
        // starting at 2: constructing a formmodel + creating valueModel
View Full Code Here

        fm.clearValidationMessage(message1);
        assertEquals(1, r.getMessageCount());
    }

    public void testChangingValidatingClearsMessagesOrValidates() {
        DefaultFormModel fm = (DefaultFormModel) getFormModel(new TestBean());
        ValidationResultsModel r = fm.getValidationResults();
        TestValidator v = new TestValidator();
        // starting at 2: constructing a formmodel + creating valueModel
        int expectedCount = 2;
        v.results = getValidationResults("message1");
View Full Code Here

        vm.setValue("test");
        assertEquals(0, fm.getValidationResults().getMessageCount());
    }

    public void testTypeConversionThrowsExceptionRaisesValidationMessage() {
        DefaultFormModel fm = (DefaultFormModel) getFormModel(new TestBean());
        TestConversionService cs = new TestConversionService();
        cs.executer = new ConversionExecutor(String.class, Integer.class, new ExceptionConverter(String.class,
                Integer.class));
        fm.setConversionService(cs);
        final ValueModel vm = fm.getValueModel("simpleProperty", Integer.class);
View Full Code Here

        assertEquals(1, fm.getValidationResults().getMessageCount());
    }

    public void testValidatingEvents() {
        TestPropertyChangeListener pcl = new TestPropertyChangeListener(ValidatingFormModel.VALIDATING_PROPERTY);
        DefaultFormModel fm = (DefaultFormModel) getFormModel(new TestBean());
        fm.addPropertyChangeListener(ValidatingFormModel.VALIDATING_PROPERTY, pcl);
        assertTrue(fm.isEnabled());

        fm.setValidating(false);
        assertTrue(!fm.isValidating());
View Full Code Here

        assertTrue(fm.isValidating());
        assertEquals(2, pcl.eventCount());
    }

    public void testReadOnlyRevert() {
        FormModel fm = getFormModel(new TestBean());
        fm.getValueModel("readOnly");
        fm.revert();

        // no additional asserts, this test should just not throw an exception!
    }
View Full Code Here

        // no additional asserts, this test should just not throw an exception!
    }

    public void testDefaultFormModelFromValueModel() throws Exception {
        TestBean testBean = new TestBean();
        ValueModel valueModel = new ValueHolder(testBean);
        DefaultFormModel model = new DefaultFormModel(valueModel);
        assertEquals(testBean, model.getFormObject());
    }
View Full Code Here

    /**
     * Test method for
     * {@link org.springframework.richclient.form.AbstractForm#addChildForm(org.springframework.richclient.form.Form)}.
     */
    public void testAddChildForm() {
        TestBean testBean = new TestBean();
        testBean.setNestedProperty(new TestBean());
        HierarchicalFormModel model = new DefaultFormModel(testBean);
        ValidatingFormModel childModel = FormModelHelper.createChildPageFormModel(model, "test", "nestedProperty");
        AbstractForm form = new TestAbstractForm(model);
        form.addChildForm(new TestAbstractForm(childModel));
    }
View Full Code Here

TOP

Related Classes of org.springframework.binding.support.TestBean

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.