Wednesday, November 22, 2017

Strange Issue with Nested Editors

I am trying to use a nested editors; however its been failing at the code generation step.
Below is a sample code snippet to explain the issue:

public class ParentView
 
implements Editor<Parent>{

 
interface Binder
 
extends UiBinder<Widget, ParentView> {
 
}

 
interface Driver
 
extends SimpleBeanEditorDriver<Parent, ParentView> {
 
}

 
@UiField @Editor.Path ("child1") ChildView childView;
 
@UiField @Editor.Path ("child2") Child2View child2View;


public class ChildView
 
extends Composite
 
implements Editor<Child1> {

 
interface ChildViewUiBinder
 
extends UiBinder<HTMLPanel, ChildView> {
 
}

 
private static ChildViewUiBinder uiBinder = GWT.create(ChildViewUiBinder.class);

 
@UiField @Editor.Path ("") AddressForm<Child1> formAddress;
 
@UiField @Path ("") InformationForm<Child1> informationForm;


public class AddressForm<T>
 
extends Composite
 
implements Editor<T> {

 
interface AddressFormUiBinder
 
extends UiBinder<HTMLPanel, AddressForm> {
 
}

 
private static AddressFormUiBinder uiBinder = GWT.create(AddressFormUiBinder.class);

 
@UiField InputEditor<String> address1;
 
@UiField InputEditor<String> address2;
 
@UiField InputEditor<String> city;
 
@UiField SelectEditor<String> stateCode;
 
@UiField InputEditor<String> zip;


public class InformationForm<T>
 
extends Composite
 
implements Editor<T> {

 
interface InformationFormUiBinder
 
extends UiBinder<HTMLPanel, InformationForm> {
 
}

 
private static InformationFormUiBinder uiBinder = GWT.create(InformationFormUiBinder.class);

 
@UiField InputEditor<Integer> a;
 
@UiField InputEditor<Float> b;


When I try to compile the above code, I get the below error:
[ERROR] Could not find a getter for path getFormAddress in proxy type com.......Child1                 [ERROR] Unable to create Editor model due to previous errors


The class hierarchy looks like this:
public class Parent {

 
private Child1 child1;
 
private Child2 child2;

 
public Child1 getChild1() {
   
return child1;
 
}

 
public void setChild1(Child1 child1) {
 
this.child1 = child1;
 
}

 
public Child2 getChild2() {
   
return child2;
 
}

 
public void setChild2(Child2 child2) {
   
this.child2 = child2;
 
}
}


public class Child1 {

 
private Integer id;
 
//below are common for AddressForm
 
private String address1;
 
private String address2;
 
private String address3;
 
private String city;
 
private String stateCode;
 
private String zip;

 
//below are common for InformationForm
 
private int a;
 
private float b;



I can use the AddressForm<T> widget successfully when its a direct child of the parent view; however it fails in the above case where it is in the child view.
InformationForm<T> on the other hand works correctly without any issues.


Appreciate any help regarding this.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment