Package org.springframework.binding.support

Examples of org.springframework.binding.support.BeanPropertyAccessStrategy


public class PropertyAdapter extends AbstractValueModelAdapter {

    private final ValueModel propertValueModel;
   
    public PropertyAdapter(ValueModel valueModel, Object bean, String property) {
        this(valueModel, new BeanPropertyAccessStrategy(bean), property);
    }
View Full Code Here


  public AbstractFormModel(Object domainObject, boolean buffered) {
    this(new ValueHolder(domainObject), buffered);
  }

  protected AbstractFormModel(ValueModel domainObjectHolder, boolean buffered) {
    this(new BeanPropertyAccessStrategy(domainObjectHolder), buffered);
  }
View Full Code Here

    /**
     * Tests read actions on a read-only model.
     */
    public void testReadOnly() {
        TestBean bean = new TestBean();
        ValueModel readOnlyModel = new BeanPropertyAccessStrategy(bean).getPropertyValueModel("readOnly");
        BufferedValueModel buffer = new BufferedValueModel(readOnlyModel, commitTrigger);
       
        assertSame(
            "Can read values from a read-only model.",
            buffer.getValue(),
View Full Code Here

    super();
    if (bean instanceof PropertyAccessStrategy) {
      this.beanPropertyAccessStrategy = (PropertyAccessStrategy) bean;
    }
    else {
      this.beanPropertyAccessStrategy = new BeanPropertyAccessStrategy(
          bean);
    }
  }
View Full Code Here

    }
    return true;
  }

  protected MutablePropertyAccessStrategy createPropertyAccessStrategy(Object o) {
    return new BeanPropertyAccessStrategy(o);
  }
View Full Code Here

  public boolean test(Object o) {
    if (o instanceof PropertyAccessStrategy)
      return test((PropertyAccessStrategy)o);

        return test(new BeanPropertyAccessStrategy(o));
  }
View Full Code Here

    }
  }

  public void testUnbufferedWritesThrough() {
    TestBean p = new TestBean();
    BeanPropertyAccessStrategy pas = new BeanPropertyAccessStrategy(p);
    AbstractFormModel fm = getFormModel(pas, false);
    ValueModel vm = fm.getValueModel("simpleProperty");

    vm.setValue("1");
    assertEquals("1", p.getSimpleProperty());
View Full Code Here

    assertEquals(null, p.getSimpleProperty());
  }

  public void testBufferedDoesNotWriteThrough() {
    TestBean p = new TestBean();
    BeanPropertyAccessStrategy pas = new BeanPropertyAccessStrategy(p);
    AbstractFormModel fm = getFormModel(pas, true);
    ValueModel vm = fm.getValueModel("simpleProperty");

    vm.setValue("1");
    assertEquals(null, p.getSimpleProperty());
View Full Code Here

    testDirtyTracking(false);
  }

  public void testDirtyTracking(boolean buffering) {
    TestBean p = new TestBean();
    BeanPropertyAccessStrategy pas = new BeanPropertyAccessStrategy(p);
    TestPropertyChangeListener pcl = new TestPropertyChangeListener(FormModel.DIRTY_PROPERTY);
    AbstractFormModel fm = getFormModel(pas, buffering);
    fm.addPropertyChangeListener(FormModel.DIRTY_PROPERTY, pcl);
    ValueModel vm = fm.getValueModel("simpleProperty");
    assertTrue(!fm.isDirty());
View Full Code Here

    assertEquals(6, pcl.eventCount());
  }

  public void testSetFormObjectDoesNotRevertChangesToPreviousFormObject() {
    TestBean p1 = new TestBean();
    BeanPropertyAccessStrategy pas = new BeanPropertyAccessStrategy(p1);
    AbstractFormModel fm = getFormModel(pas, false);
    fm.getValueModel("simpleProperty").setValue("1");
    fm.setFormObject(new TestBean());
    assertEquals("1", p1.getSimpleProperty());
  }
View Full Code Here

TOP

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

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.