Marko Zadravec
Marko Zadravec

Reputation: 8730

Eclipse Scout custom object in form data

I have some problem.

I have some object :

public class TestParameter {

  private Long par1;
  private Long par2;

  public Long getPar1() {

    return par1;
  }

  public void setPar1(final Long par1) {

   this.par1 = par1;
  }

  public Long getPar2() {

    return par2;
  }

  public void setPar2(final Long par2) {

   this.par2 = par2;
  }
}

And I have form with this bean :

@FormData(value = PurchaseConditionsEditFormData.class, sdkCommand = FormData.SdkCommand.CREATE)
public class TestForm extends AbstractForm {

  private TestParameter m_testParameter;

  @FormData
  public TestParameter getTestParameter() {

    return m_testParameter;
  }

  @FormData
  public void setTestParameter(final TestParameter testParameter) {

    m_testParameter = testParameter;
  }
}

My problem is that I can use this in form data, because inside form data this is created

 /**
  * access method for property TestParameter.
  */
 public TestParameter getTestParameter() {

   return getSearchParameterProperty().getValue();
 }

 /**
  * access method for property TestParameter.
  */
 public void setSearchParameter(TestParameter testParameter) {

   getTestParameterProperty().setValue(testParameter);
 }

 public TestParameterProperty getTestParameterProperty() {

   return getPropertyByClass(TestParameterProperty.class);
 }

 public static class TestParameterProperty extends
  AbstractPropertyData<TestParameter> {

   private static final long serialVersionUID = 1L;

   public TestParameterProperty() {

  }
 }

Problem is that setSearchParameter() is never called, and that getTestParameterProperty() returns object with value= null.

How to fix it ?

I know that dirty solution would be to put all properties outside object and directly in form, but I don't want that solution.

Upvotes: 1

Views: 58

Answers (1)

Marko Zadravec
Marko Zadravec

Reputation: 8730

I figure out what was my problem.

Object needs to be Serializable, then it works.

Upvotes: 1

Related Questions