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

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -