3 Replies Latest reply on Apr 30, 2015 2:22 PM by Juan Calderón

    How to bind a DateBox  with Errai binding?

    Juan Calderón Newbie

      Hello,

       

      I'm using Errai Binding according to (Data Binding - Errai - Project Documentation Editor).

       

      Model >>

      @Bindable

      .. Empleado ..{

         ....

         Date fecha;

         .....

      }

       

      View>>

      ....

      DateBox fechaDateBox;

      ....

       

      dataBinder = DataBinder.forType(Empleado.class);

      empleado = dataBinder

                      .bind(fechaDateBox, "fecha")

                      .getModel();

       

      When I change the fechaDateBox, it throws an UmbrellaException.

       

      I tried changing data-type String/Date, binding fechaDateBox.getTextBox(), .getDateTimePicker() and with a Convert.

       

      DateBox implements HasValue.

       

      So, which is the correct way to bind a DateBox with a Date property.

       

      I'm using the SuperDev Mode. Into Developer Tools of Chrome, the UmbrellaException is throw by the class com.google.gwt.event.shared.HandlerManager line 127

      ....

      // May throw an UmbrellaException.

      eventBus.fireEvent(event);

      ...

       

      UmbrellaException_5_g$ {cause_1_g$: UmbrellaException_5_g$, detailMessage_0_g$: "Exception caught: Exception caught: 01/01/2004", stackTrace_1_g$: null, __gwt$backingJsError: Error: Exception caught: Exception caught: 01/01/2004,causes_1_g$: HashSet_1_g$…}

       

      1. __gwt$backingJsError: Error: Exception caught: Exception caught: 01/01/2004
      2. cause_1_g$: UmbrellaException_5_g$
      3. causes_1_g$: HashSet_1_g$
      4. detailMessage_0_g$: "Exception caught: Exception caught: 01/01/2004"
      5. stackTrace_1_g$: null
      6. __proto__: Object

       

      or

       

      1. detailMessage_0_g$: "Exception caught: Exception caught: fecha"

      Thanks.

        • 1. Re: How to bind a DateBox  with Errai binding?
          Juan Calderón Newbie

          Into the class org.jboss.errai.databinding.client.BindableProxyAgent

           

          in the code:

          ....

                handlerRegistration = ((HasValue) widget).addValueChangeHandler(new ValueChangeHandler() {

                  @Override

                  public void onValueChange(ValueChangeEvent event) {

                    Object oldValue = proxy.get(property);

                    Object newValue = toModelValue(propertyTypes.get(property).getType(), widget, event.getValue(), converter);

                    proxy.set(property, newValue);

                    updateWidgetsAndFireEvent(property, oldValue, newValue, widget);

                  }

          ....

          this line: proxy.set(property, newValue); throws the NonExistingPropertyException for "fecha"

           

          Thanks,

          • 2. Re: How to bind a DateBox  with Errai binding?
            Christian Sadilek Master

            Hi,

             

            This means that "fecha" is not a valid Java property or at least it wasn't recognized as one. Do you have getters/setters for it? Can you share your complete bindable/data type.

             

            Cheers,

            Christian

            • 3. Re: How to bind a DateBox  with Errai binding?
              Juan Calderón Newbie

              Problem/Solution found it.

               

              Into .errai/BindableProxyLoaderImpl.java, Errai tries to override the getters/setters of the Model; however, the setter for fecha is final, so that blocks to override the setFecha method.

               

              I had already removed the final but the gwt-incremental compilation is not enough to make effective the change into BindableProxyLoaderImpl. It was necessary to Clean/Build the full project; at least in NetBeans.

               

              Thanks,

               

              Juan