Reputation: 31225
I have this component with a @UiConstrutor
annotation :
@UiConstructor
public SearchWidget(Widget filterWidget, Widget resultWidget) {
...
}
in the ui.xml, I must write something like :
<SearchWidget filterWidget="" resultWidget=""/>
The problem is that I would like to be able to build a complex widget apart in ui.xml and use in the <SearchWidget>
tag, something like :
<with field="filterWidget">
<Widget>
...
</Widget>
</with>
<With field="resultWidget">
<Widget>
...
</Widget>
</with>
And then use it like :
<SearchWidget filterWidget="{filterWidget}" resultWidget="{resultWidget}"/>
Is their an existing approaching syntax?
Upvotes: 0
Views: 139
Reputation: 7817
You can try to use @UiChild
annotation (if you can replace constructor dependencies by corresponding methods). See corresponding javadoc with example.
Two new methods:
@UiChild SearchWidget#addFilterWidget(Widget w)
@UiChild SearchWidget#addResultWidget(Widget w)
UiBinder (you need to declare new p
namespace for your custom widgets):
<p:SearchWidget>
<p:filterWidget><p:Widget>...</p:Widget></p:filterWidget>
<p:resultWidget><p:Widget>...</p:Widget></p:resultWidget>
</p:SearchWidget>
Upvotes: 3