How could I pass the parent instance reference to the child element in the ui.xml?

82 views Asked by At

I want to pass the parent reference to the child element in the ui.xml.

Here is the Child.java

public class Child extends Composite {

    private static ChildUiBinder uiBinder = GWT.create(ChildUiBinder.class);
    
    ParentView parentView;
    
    interface ChildUiBinder extends UiBinder<Widget, Child> {
    }
    
    public  Child( ) {
        initWidget(uiBinder.createAndBindUi(this));
        
    }

    public ParentView getParentView() {
        return parentView;
    }

    public void setParentView(ParentView parentView) {
        this.parentView = parentView;
    }

}

And here is UI definition in the parent.ui.xml

...
<g:HTMLPanel>


   <my:Child ui:field='child' mainView= "{this}"/>

</g:HTMLPanel>

Obviously, this way to pass parent reference is not correct.

0

There are 0 answers