I've used JSP tag libs, freemarker, tiles, JSF-Facelets extensively in the past. Similar to their use of taglibs, is there anyway I could do the following in GWT UiBinder:
1) Composition: create a tag library in UiBinder (no java code) and include the tag into another uiBinder file 2) Inheritance: create a base layout UiBinder file (master layoyut) and override specific content areas in child UiBinder files? 3) Pass clientside variables into UiBinder ($(map.property))
In general, I'm not sure how UiBinder compares with other templating libraries.
To insert a content of one page in another with UiBinder create a class mypackage.Header
together with a file Header.ui.xml
in the same package mypackage
. Then your UiBinder holder-file should look 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:mypackage'>
<g:HTMLPanel>
<my:Header />
<!-- other content -->
</g:HTMLPanel>
</ui:UiBinder>
In the first place UiBinder is a very convenient tool for separating UI from its behavior. In addition it helps productivity(it's true!), maintainability, and has other features.
UiBinder in GWT is very different from JSF approach. This tool isn't a render. In contrast to JSF it not contain any loops or condition. There are no if
statements in its markup and only a very limited expression language. All the logic is in Java class. And rightly so. It's logical to have loops and conditionals in the class than in view.