1 Reply Latest reply on Nov 20, 2013 12:24 PM by Christian Sadilek

    how to make @UiHandler annoted methods being called only after databing ?

    Anthony Foulfoin Newbie



      I'm using Errai to make databinding on my application that uses GWT UiBinder.

      The databinding works well, but my UI needs to react to some events, such as ChangeEvent.

      Here is an exemple :


      public class myView  {
        Customer customer;
        @Bound(property = "partner")
        ListBox partnerListBox;
        public void initClientListBox(ChangeEvent event) {
        String partner = customer.getPartner();


      The problem is that when my initClientListBox() method is called to handle the ChangeEvent, the ErraiDatabing has not updated the model yet.

      So I cannot use my model in that use case.


      Errai allows to register a PropertyChangeHandler :



      dataBinder.addPropertyChangeHandler("name", newPropertyChangeHandler() {


        publicvoidonPropertyChange(PropertyChangeEvent event) {

          Window.alert("name changed to:"+ event.getNewValue());




      But I think this is a boilerplate code, it would have been great if there was an annotation like this :


        public void onPropertyChange(PropertyChangeEvent event) {
          Window.alert("name changed to:" + event.getNewValue());


      But I didn't find an annotation like this in Errai.

      Consequently, I have no choice but to use directly the widget value, while I think using the model would be cleaner.


      Do you think there is an easy way to use the model value in such a use case ?