java - Is it possible to reference a field variable from .ui.xml initialized in constructor? -


i trying pass paramter composite's (registrationviewer) constructor via uibinder/ui.xml.

my view.ui.xml looks this:

    ...     <ui:with field='registration' type='com.example.dto.registrationdto'/>     ...     <composites:registrationviewer ui:field="registrationviewer" registration="{registration}"/>     ... 

my view.java looks this:

    ...     @uifield @ignore public registrationdto registration;     @uifield registrationviewer registrationviewer;      public view(registrationdto registration) {         this.registration = registration;         initwidget(uibinder.createandbindui(this));     } 

my registrationviewer.java:

    private final registrationdto registration;      @uiconstructor     public registrationviewer(registrationdto registration) {         this.registration = registration;         initwidget(uibinder.createandbindui(this));     } 

however, fields of registration parameter null in registrationviewer constructor. seems gwt doesn't pick correct instance of registrationdto , tries create new instance of it.

my question is: trying - possible?

@uifield has provided property default value false, meaning uibinder create instance , assign field. if provide value yourself, set true:

@uifield(provided = true) registrationdto registration; 

(btw, you're setting constructor, i'd go far making field final)


Comments

Popular posts from this blog

c# - How can I have the VS Debugger break in the correct location for exceptions thrown in Async methods in a Console App? -

php - Issues outputting data after prepared statement with loops -

javascript - How to pass a property by reference -