-
1. Re: Errai UI templating: omit or inline content
csa Jun 17, 2014 4:33 PM (in response to aanderson1776)1 of 1 people found this helpfulHi Aaron,
Both sound like good features to me that we don't currently support. Unfortunately, the template snippets you pasted rendered as actual HTML so I am not 100% sure. Can you create two JIRAs for these features with an example?
Thanks,
Christian
-
2. Re: Errai UI templating: omit or inline content
aanderson1776 Jul 18, 2014 11:52 AM (in response to aanderson1776)I discovered that Errai UI template merging partially accomplishes what I was looking for. If I had a template nav.html that contained the following HTML snippet:
<span data-field="account-id"> <small>Account</small> AccountId </span>
Due to Errai template merging I can manipulate the template DOM as desired:
@Templated(LayoutTemplates.NAVBAR + "#account") public class Account extends Composite { @DataField("account-id") Element accountId = Document.get().createSpanElement(); public void init(User user) { Window.alert(accountId.getChildCount() + " -> " +((Text)accountId.getChild(2)).getData()); ((Text)accountId.getChild(2)).setData(user.getIdentifier()); } }
Presumptuously manipulating the template DOM in Errai may not be the best practice since because if the template is modified the DOM manipulation code may silently error out. However this leads to the larger general design question with Errai: how much static content is generated in Java/GWT versus what how much is maintained in templates.