Search code examples
eclipse-scout

Eclipse Scout Neon importFormFieldData in template


I have template group box, for reuse purposes.

In this template I have function witch need to fill data inside this template. Because you can't create new instance of FormData in template I have abstract function for getting new instance of form data. Then each form that use this template implement this method.

 protected abstract AbstractMyBoxData getFormData();

My function is look like this :

 public void setValuesInTemplates(Long parameter)
 {
    AbstractMyBoxData formData = this.getFormData();
    this.exportFormFieldData(formData);
    formData = BEANS.get(iMyService.class).setSomeValue(parameter);
    this.importFormFieldData(formData, true);
 } 

My problem is that I get correct form data from service, but when I import this form data, template does not change UI.

Why is this?


Solution

  • Have a look at the implementation of importFormFieldData(..) for groupboxes. The implementation is defined here:

    AbstractFormField.importFormFieldData(AbstractFormFieldData, boolean)
    

    … and it is empty.

    The complete explanation (and a solution) can be found here:

    Table and GroupBox for details on row selection

    [You probably need to redo it for Neon, but the changes are not so big. Most of the code in FormDataUtility2 is copy pasted from AbstractForm].

    I am convinced that it is a mistake to have the import logic hardcoded in the Form, but I did not manage to convince the team back then. Feel free to add a comment in forum Post.