Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does (provide = true) do in GWT?

Tags:

gwt

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?

like image 721
injoy Avatar asked Dec 18 '22 21:12

injoy


1 Answers

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.

like image 140
thst Avatar answered Jan 12 '23 02:01

thst