I have some abstract form :
@FormData(value = AbstractMyFormData.class, sdkCommand = FormData.SdkCommand.CREATE)
public abstract class AbstractMyForm extends AbstractForm {
...
@Order(10.0)
@ClassId("MyForm.MyTable")
public class MyTable extends AbstractMyTableField {
...
}
}
This form data has some table (MyTable class as template) inside :
public abstract class AbstractMyFormData extends AbstractFormData {
private static final long serialVersionUID = 1L;
public AbstractMyFormData() {}
public MyTable getMyTable() {
return getFieldByClass(MyTable.class);
}
public static class MyTable extends AbstractMyTableData {
private static final long serialVersionUID = 1L;
public MyTable() {}
}
}
My real form extends AbstractMyForm :
@FormData(value = MyFormData.class, sdkCommand = FormData.SdkCommand.CREATE)
public class MyForm extends AbstractMyForm {
...
@Order(10.0)
@ClassId("MyForm.MyTable")
public class MyTable extends AbstractMyTableField {
...
}
}
form data for this is :
public class MyFormData extends AbstractMyFormData {
public MyTable getMyTable() {
return getFieldByClass(MyTable.class);
}
public static class MyTable extends AbstractMyTableData {
private static final long serialVersionUID = 1L;
public MyTable() {}
}
.....
.....
}
The problem is that both form datas (AbstractMyFormData and MyFormData) has implemented
public static class MyTable extends AbstractMyTableData
and than scout complains that has duplicate method getMyTable()
.
But I don't understand this. If MyFormData is extend from AbstractMyFormData than MyFormData must not have this method inside because it already has it his parent.
How to do this? I see FormData.SdkCommand.USE
that by description might be it, but I don't now how to use it.
Second question witch might be related is how to inject table in AbstractMyForm like normal AbstractForm inject Cancel button?
EDIT :
Code for classes :
ABSTRACT FORM
@FormData(value = AbstractPurchasePriceFormData.class, sdkCommand = FormData.SdkCommand.CREATE)
@ClassId("41f0f405-b257-47e7-accf-270f5be158ce")
public abstract class AbstractMyForm extends AbstractForm {
/**
* @throws org.eclipse.scout.commons.exception.ProcessingException
*/
public AbstractMyForm() throws ProcessingException {
super();
}
@Order(10.0)
public class MainBox extends AbstractGroupBox {
@Order(10.0)
public class MyTable extends AbstractMyTableField {
}
}
@Override
protected String getConfiguredTitle() {
return TEXTS.get("AbstractMyForm");
}
}
AbstractMyTableField template :
import org.eclipse.scout.commons.annotations.FormData;
import org.eclipse.scout.commons.annotations.Order;
import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractIntegerColumn;
import org.eclipse.scout.rt.client.ui.basic.table.columns.AbstractStringColumn;
import org.eclipse.scout.rt.client.ui.form.fields.tablefield.AbstractTableField;
import org.eclipse.scout.rt.extension.client.ui.basic.table.AbstractExtensibleTable;
@FormData(value = AbstractMyTableFieldData.class, sdkCommand = FormData.SdkCommand.CREATE, defaultSubtypeSdkCommand = FormData.DefaultSubtypeSdkCommand.CREATE)
public abstract class AbstractMyTableField extends AbstractTableField<AbstractMyTableField.Table> {
@Order(10.0)
public class Table extends AbstractExtensibleTable {
@Order(10.0)
public class NameColumn extends AbstractStringColumn {
}
@Order(20.0)
public class AgeColumn extends AbstractIntegerColumn {
}
}
}
FOR REAL FORM you just create form from template :
and in main box add MyTable like :
insted :
@Order(10.0)
public class MainBox extends AbstractGroupBox {
}
do :
@Order(10.0)
public class MainBox extends AbstractGroupBox {
@Order(10.0)
public class MyTable extends AbstractMyTableField {
}
}
I hope I was more explicit this time.
EDIT 2
I admit that creating main box inside abstract form is maybe not the right approach, but what I want to achive is to have AbstractMyTableField
in AbstractMyFormData, so I can rely on server side that all forms that extend from AbstractMyForm has this in form data so I can write only one server method for all forms (returning AbstractMyFormData).