Hi all.
Errai-UI allows us create @JsType elements and bind it to a document with @Data-field annotation. It works like a charm but sometimes we could have a little overhead in case we have a number of such elements and this elements have no behavier like Patterfly’s row-cards-pf for instance. GWT's Uibinder provides this ability via namespaces and i decided to do something like that for my personal project.
https://github.com/treblereel/errai-uibinder
So how it works?
I need to annotate @Templated with @UiBinder annotation and set mapping between namespaces and packages like that:
@UiBinder({ @Namespace(ns = "ns", name = "org.jboss.errai.ui.test.integration.client.res"), @Namespace(ns = "w", name = "org.jboss.errai.ui.test.integration.client.res.widgets") }) @ApplicationScoped @Templated(value = "my-page.html#contact") public class MyPage extends Composite {
In a template all I need to do us just use namespace:class_name as a tag, as a result, this will be replaces by @Element with its classes and properties, original properties and classes will be merged also.
<ns:MyInput></ ns:MyInput>
=>
<input class="my_class" placeholder="fooblie" type="text">
Pros are : we don't need to annotate any custom element with data-field many times per template, which is overhead and it's easer to do wrappers over js frameworks like Patterfly or three.js.
Cons are : additions compile time and app boot time, plus each element costs some code as well.
What do you think ?