I just created widget:
public class myWidget<T> extends FlowPanel {
private T value;
public T getValue()
{
return value;
}
public myWidget(T[] values) {
for (T value : values)
{
//do action
}
}
How can I add it using UiBinder? Is it possible at all?
Yes you can. You have to import the package which contains the myWidget
class into an XML namespace. Say your package is called com.test.widgets
, the declarative layout looks like this:
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:my='urn:import:com.test.widgets'>
<my:myWidget>
<g:Label>A label</g:Label>
<g:Label>A second label</g:Label>
</my:myWidget>
</ui:UiBinder>
Note the import xmlns:my='urn:import:com.test.widgets'
and the usage <my:myWidget>
.