Package org.strecks.bind.handler.impl

Examples of org.strecks.bind.handler.impl.BindableBean


    handler.setBeanLookupExpression(null);
    handler.setTargetBeanExpression(null);
    handler.setBeanPropertyName("domainClass");
    handler.setBeanPropertyClass(Integer.class);

    BindableBean form = new BindableBean();
    Collection collection = new ArrayList();
    collection.add(new DomainClass(1));
    collection.add(new DomainClass(3));
    collection.add(new DomainClass(4));
    Map map = handler.getPropertyAsMap(collection);
    form.setLookupMap(map);

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);
    targetBean.setDomainClass(new DomainClass(4));

    handler.bindOutwards(form, form);

    Assert.assertEquals(form.getSelectedId(), "4");

  }
View Full Code Here


  @SuppressWarnings("unchecked")
  @Test
  public void testEmptyMapBindOutwards()
  {

    BindableBean form = new BindableBean();
    Map map = handler.getPropertyAsMap(new HashMap());
    form.setLookupMap(map);

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);
    targetBean.setDomainClass(new DomainClass(4));

    handler.bindOutwards(form, form);

    Assert.assertEquals(form.getSelectedId(), "4");

  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void testNullTargetBindOutwards()
  {

    BindableBean form = new BindableBean();
    Collection collection = new ArrayList();
    collection.add(new DomainClass(1));
    collection.add(new DomainClass(3));
    collection.add(new DomainClass(4));
    Map map = handler.getPropertyAsMap(collection);
    form.setLookupMap(map);

    TargetBean targetBean = new TargetBean();
    // form.setTargetBean(targetBean);
    targetBean.setDomainClass(new DomainClass(4));

    handler.bindOutwards(form, form);

    Assert.assertEquals(form.getSelectedId(), null);

  }
View Full Code Here

    handler.setBeanLookupExpression(null);
    handler.setTargetBeanExpression(null);
    handler.setBeanPropertyName("domainClass");
    handler.setBeanPropertyClass(Integer.class);

    BindableBean form = new BindableBean();
    form.setLookupMap(null);

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);
    targetBean.setDomainClass(new DomainClass(4));

    handler.bindOutwards(form, form);

    Assert.assertEquals(form.getSelectedId(), "4");

  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void testTargetBindInwards()
  {

    BindableBean form = new BindableBean();
    Collection collection = new ArrayList();
    collection.add(new DomainClass(1));
    collection.add(new DomainClass(3));
    collection.add(new DomainClass(4));
    Map map = handler.getPropertyAsMap(collection);
    form.setLookupMap(map);

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);

    form.setSelectedId("1");
    handler.bindInwards(form, form, null);

    assert targetBean.getDomainClass().getId() == 1;

  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void testNullTargetBindInwards()
  {

    BindableBean form = new BindableBean();
    Collection collection = new ArrayList();
    collection.add(new DomainClass(1));
    collection.add(new DomainClass(3));
    collection.add(new DomainClass(4));
    Map map = handler.getPropertyAsMap(collection);
    form.setLookupMap(map);

    TargetBean targetBean = new TargetBean();
    // form.setTargetBean(targetBean);

    form.setSelectedId("1");
    handler.bindInwards(form, form, null);

    assert targetBean.getDomainClass() == null;

  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void testEmptyMapBindInwards()
  {

    BindableBean form = new BindableBean();
    form.setLookupMap(new HashMap());

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);

    form.setSelectedId("1");
    handler.bindInwards(form, form, null);

    assert targetBean.getDomainClass() == null;

  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void testNullMapBindInwards()
  {

    BindableBean form = new BindableBean();
    form.setLookupMap(null);

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);

    form.setSelectedId("1");
    handler.bindInwards(form, form, null);

    assert targetBean.getDomainClass() == null;

  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void testInvalidIdBindInwards()
  {

    BindableBean form = new BindableBean();
    Collection collection = new ArrayList();
    collection.add(new DomainClass(1));
    collection.add(new DomainClass(3));
    collection.add(new DomainClass(4));
    Map map = handler.getPropertyAsMap(collection);
    form.setLookupMap(map);

    TargetBean targetBean = new TargetBean();
    form.setTargetBean(targetBean);

    form.setSelectedId("10");
    handler.bindInwards(form, form, null);

    assert targetBean.getDomainClass() == null;

  }
View Full Code Here

  public void testGetTargetBean()
  {

    TargetBean bean = new TargetBean();
    bean.setStringProperty("2");
    BindableBean form = new BindableBean();
    form.setTargetBean(bean);
    DomainClass domclass = new DomainClass(1);
    bean.setDomainClass(domclass);

    Object targetBean = PropertyValueGetter.getTargetBean(form, "targetBean");
    assert targetBean instanceof TargetBean;

    targetBean = PropertyValueGetter.getTargetBean(form, "targetBean.domainClass");
    assert targetBean instanceof DomainClass;

    bean.setDomainClass(null);
    assert null == PropertyValueGetter.getTargetBean(form, "targetBean.domainClass");

    form.setTargetBean(null);
    assert null == PropertyValueGetter.getTargetBean(form, "targetBean.domainClass");
    assert null == PropertyValueGetter.getTargetBean(form, "targetBean");

  }
View Full Code Here

TOP

Related Classes of org.strecks.bind.handler.impl.BindableBean

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.