One common design that I have with GWT is to create a widget that contains two children: A and B.
I declare these two widgets A and B in the uibinder file associated with my main widgets.
What I want to do is load or not widget A depending on the if statement.
The ideal approach is to set the provided = true for widget A and set widget A to null when I want to not load this widget. But GWT gives an error.
Is there a way to declare widgets in uibinder and then not load them?
thank
EDIT: After much discussion, the ideal approach is to declare the fields "provided = true" and "optional = true", when optional = true, createAndBindUI should not throw an exception if the field is null. This is a clean approach.
If you think this feature should exist in GWT, please click this issue:
http://code.google.com/p/google-web-toolkit/issues/detail?id=5699
EDIT 2: using LazyPanel as described by Thomas seems to be the best way to handle this.
source
share