2 Replies Latest reply on Feb 10, 2015 3:50 PM by csa

    PropertyChangeHandler, listening recursively for events from one Child versus All Children.

    pnakaska

      Given a parent class A that has a List of children of type class B

       

      class A {

           private List <B> children;

      }

      class B {

           private String test;

      }

      the A class is Bound in an Errai Widget (AWidget.java):

       

        @Inject  @AutoBound  private DataBinder<A> aBinder;

       

      and it's nested list of B instances is Bound using a ListWidget:

       

      @Inject @Bound(property = "children")  @DataField  private ListWidget<B, BWidget> bList;

       

      In the A class' Widget, using a PropertyChangeHandler, to listen for events from the nested list,

      the "**" notation allows the parent (AWidget) to recursively hear events from any of the children:

       

      aModelBinder.addPropertyChangeHandler("**", handler);

       

      If any one of the (Bound) children change, the handler does receive events, but the source that arrives in the event

      is the entire list, not the specific child that has changed.

       

      Is there any way to specify that the source received in the event is the specific child that has changed? So that the whole

      list need not be traversed to determine what's changed?