Object owner) throws GwtTestUiBinderException {
String alias = getResourceAlias(localName, attributes);
if (resources.containsKey(alias)) {
throw new GwtTestUiBinderException("Two inner resources '" + alias + " are declared in "
+ owner.getClass().getSimpleName()
+ ".ui.xml. You should add a 'field' attribute to one of them");
}
Class<?> type = getResourceType(alias, localName, attributes);
if ("with".equals(localName)) {
// special resource <ui:with> : the resource can be annotated with
// @UiConstructor, @UiFactory or @UiField(provided=true)
Object resource = UiBinderInstanciator.getInstance(type, attributes, owner);
resources.put(alias, resource);
return new UiWithTag(resource);
}
ResourcePrototypeProxyBuilder builder = ResourcePrototypeProxyBuilder.createBuilder(type,
owner.getClass());
// common properties
builder.name(alias);
if ("style".equals(localName)) {
// <ui:style>
return new UiStyleTag(builder, alias, parentTag, owner, resources);
} else if ("image".equals(localName)) {
// <ui:image>
return new UiImgTag(builder, alias, parentTag, owner, resources, attributes);
} else if ("data".equals(localName)) {
// <ui:data>
return new UiDataTag(builder, alias, parentTag, owner, resources, attributes);
} else {
throw new GwtTestUiBinderException("resource <" + localName
+ "> element is not yet implemented by gwt-test-utils");
}
}