In many cases I have the same panel which edits a set of properties that are common to different DTOs. So I want to have this panels defined only once and reuse so I came up with the following implementation for one of them:
public class IdentificationPanel<M> extends Panel implements Editor<M> {
BusinessUnitField businessUnit;
OperationCodeField operationCode;
OperationNumber operationNumber;
...........
}
So I will use the IdentificationPanel with different DTOs depending on the Models I will need to edit. For example I have:
public class ExampleTrans01 extends ModelDTO {
private ExampleTrans01Header header;
.......
}
public class ExampleTrans02 extends ModelDTO {
private ExampleTrans02Header header;
.....
}
public class ExampleTrans01Header extends ModelDTO {
private Integer businessUnit;
private String operationCode;
private Long operationNumber;
.......
// Setters & Getters
}
public class ExampleTrans02Header extends ModelDTO {
private Integer businessUnit;
private String operationCode;
private Long operationNumber;
.......
// Setters & Getters
}
So in the implementation of the editors for the 2 classes I need to edit I will have:
public class ExampleTrans01Editor extends Panel implements Editor<ExampleTrans01> {
@Path("header")
IdentificationPanel<ExampleTrans01Header> identification;
.......
}
public class ExampleTrans02Editor extends Panel implements Editor<ExampleTrans02> {
@Path("header")
IdentificationPanel<ExampleTrans02Header> identification;
........
}
When I try to compile this, GWT complains because it said that there is no constructor for the IdentificationPanel_businessUnit_Context class with the class ExampleTrans02Header as parent when it was generating the Delegate.
I know I maybe get rid of the problem by extending IdentificationPanel, like:
public class ExampleTrans01Identification extends IdentificationPanel<ExampleTrans01Header> {
// Nothing interesting to do here
}
public class ExampleTrans02Identification extends IdentificationPanel<ExampleTrans02Header> {
// Nothing interesting to do here
}
And then use this classes instead the parameterized, but that solution seems to be a little nasty because those classes will not have any other use.
So the question is, are there any other way of implement this case? I was wondering that this should be a very common use case, but I couldn't found much info about it.
On a side note I may said that I new to Editor Framework so maybe I was interpreting something wrong, I will appreciated if you could put me in the right direction.
Regards, Daniel
This is a known issue and there's no other known workaround.
http://code.google.com/p/google-web-toolkit/issues/detail?id=6016