In the xml file, I have some fields like:
<ui:with field="f1" type="t1"/>
In the correlated Java file, I need to use:
@UiField( provided = true ) Type t1 = ...;
so that my project won't fail. So what does (provide = true)
do in GWT? And why we need to manually write (provided = true)
in the Jave file?
The provided
parameter denotes, that the field's widget must not be created by UIBinder, but is provided by your code.
@UIField Button btnUIbinder;
@UIField(provided=true) Button btnYourCode;
public YourClassConstructor() {
btnYourCode = new Button(...); // required!
// init uibinder here
}
The provided
keyword supports widgets with complex creation procedures. Or situations, where you already have the widget from another source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With