コード例 #1
0
 @Override
 public boolean isChanged(final Object source, final Object target) {
   final Person p1 = (Person) source;
   final Person p2 = (Person) target;
   final boolean equal =
       p1.getFirstname().equals(p2.getFirstname()) && p1.getLastname().equals(p2.getLastname());
   return !equal;
 }
コード例 #2
0
 public Person copyBean(final Object source, final Object target) {
   final Person from = source != null ? (Person) source : createWorkingCopy();
   final Person to = target != null ? (Person) target : createWorkingCopy();
   to.setFirstname(from.getFirstname());
   to.setLastname(from.getLastname());
   return to;
 }
コード例 #3
0
  public void testUpdateFromModelOnRequest2() {
    final Person person = new Person("muster", "max"); // $NON-NLS-1$ //$NON-NLS-2$
    valueBindingSupport.bindToModel(person, "firstname"); // $NON-NLS-1$
    valueBindingSupport.updateFromModel();

    assertEquals("max", person.getFirstname()); // $NON-NLS-1$
    assertEquals("max", target.getValue()); // $NON-NLS-1$

    target.setValue("moritz"); // $NON-NLS-1$

    assertEquals("moritz", person.getFirstname()); // $NON-NLS-1$
    assertEquals("moritz", target.getValue()); // $NON-NLS-1$

    person.setFirstname("michel"); // $NON-NLS-1$

    assertEquals("michel", person.getFirstname()); // $NON-NLS-1$
    assertEquals("moritz", target.getValue()); // $NON-NLS-1$

    valueBindingSupport.updateFromModel();

    assertEquals("michel", person.getFirstname()); // $NON-NLS-1$
    assertEquals("michel", target.getValue()); // $NON-NLS-1$
  }