<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>I really like the simplicity of our current "template wins" strategy. I just tried the following which seems to work:</div><div><br></div><div>In the constructor of TransitionAnchor (or any other widget for that matter) you could add an AttachHandler and change the desired attribute(s):</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">MyWidget() {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp;&nbsp;&nbsp;addAttachHandler(<span style="color: rgb(147, 26, 104); ">new</span>&nbsp;Handler() {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(119, 119, 119); "><span style="color: rgb(0, 0, 0); ">&nbsp; &nbsp;&nbsp;</span>@Override</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp;&nbsp;<span style="color: rgb(147, 26, 104); ">public</span>&nbsp;<span style="color: rgb(147, 26, 104); ">void</span>&nbsp;onAttachOrDetach(AttachEvent event) {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><div style="margin: 0px; ">&nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(78, 144, 114); ">//change attributes</span></div></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp;&nbsp;}&nbsp; &nbsp; &nbsp;</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp;&nbsp;&nbsp;});</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">}</div></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">e.g.</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">TransitionAnchor(Navigation navigation,&nbsp;<span style="color: rgb(147, 26, 104); ">final</span>&nbsp;Class&lt;P&gt; toPage) {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp;...</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp;&nbsp; addAttachHandler(<span style="color: #931a68">new</span> Handler() {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(119, 119, 119); "><span style="color: #000000">&nbsp; &nbsp; </span>@Override</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp; <span style="color: #931a68">public</span> <span style="color: #931a68">void</span> onAttachOrDetach(AttachEvent event) {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp; &nbsp;&nbsp;initHref(toPage);</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp; }&nbsp; &nbsp; &nbsp;</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp;&nbsp; });</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">}</div></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div>This causes the href attribute in the template to be overridden and should work right away without changes to the framework. Eric, I built a quick prototype which worked, but it needs more testing.</div><div><br></div><div>The advantage of this programmatic solution is that it's flexible and also becomes a widget-specific feature which won't add complexity to the framework (no additional annotations required). Of course, that argument only holds if we consider this requirement an edge case, which I think it is. If this is a more common scenario we could also add an @WidgetAttached annotation to get rid of the AttachHandler boilerplate or implement the suggested @TemplateOverride.</div><div><br></div><div>Cheers,</div><div>Christian</div><div><br><div><div>On 2013-01-14, at 4:43 PM, "Lincoln Baxter, III" &lt;<a href="mailto:lincolnbaxter@gmail.com">lincolnbaxter@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Rest of the Errai team, what do you think?<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 11, 2013 at 2:08 PM, Eric Wittmann <span dir="ltr">&lt;<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">I'd be favor of some annotations to control this aspect of the templates. &nbsp;I agree that care is needed, though. &nbsp;:)<br>

<br>
Certainly an @TemplateOverride annotation per widget can make sense. Perhaps the existing @Templated annotation can have an additional attribute?<br>
<br>
Simple set of global attributes that should be widget-favored:<br>
<br>
&nbsp; &nbsp;@Templated(<br>
&nbsp; &nbsp; &nbsp; value="artifacts.html#page",<br>
&nbsp; &nbsp; &nbsp; attributeOverrides={"href", "id", "src"})<br>
<br>
That will cause the href, id, and src attributes to be widget-favored rather than template-favored.<br>
<br>
Or a more advanced possibility:<br>
<br>
@Templated(value="artifacts.<u></u>html#page", attributeOverrides={"@href", "button@id", ".help-icon@src", "#breadcrumbs@class"})<br>
<br>
That will cause the following attributes to be widget-favored:<br>
&nbsp; * All href attributes<br>
&nbsp; * The id attribute on button elements<br>
&nbsp; * The src attribute on any element with class=help-icon<br>
&nbsp; * The class attribute on the element with id=breadcrumbs<br>
<br>
Support could exist only for the spec:<br>
<br>
&lt;element&gt;[.#]&lt;classOrId&gt;@&lt;<u></u>attribute&gt;<br>
<br>
-Eric<div class="im"><br>
<br>
On 01/11/2013 01:36 PM, Lincoln Baxter, III wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Maybe we need an @TemplateOverride annotation to alter this behavior?<br>
<br>
It wouldn't be hard to do. Though... we may want the ability to do more<br>
global overrides as well... for instance, maybe you want all href<br>
attributes to default to the widget value instead.<br>
<br>
Getting the experience of this right might be tricky.<br>
<br>
Thoughts?<br>
<br>
---<br>
Lincoln Baxter's Droid<br>
<a href="http://ocpsoft.org/" target="_blank">http://ocpsoft.org</a><br>
"Keep it Simple"<br>
<br>
On Jan 11, 2013 1:14 PM, "Eric Wittmann" &lt;<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a><br></div><div><div class="h5">
&lt;mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.<u></u>com</a>&gt;&gt; wrote:<br>
<br>
&nbsp; &nbsp; No worries, Lincoln. &nbsp;Good luck with the Forge stuff. :)<br>
<br>
&nbsp; &nbsp; As for the remaining attribute issue, I came up with an acceptable<br>
&nbsp; &nbsp; workaround. &nbsp;As I mentioned in the pull request, I want the live<br>
&nbsp; &nbsp; preview/templates to be as functional as possible, including the<br>
&nbsp; &nbsp; ability to navigate around the different pages (statically when that<br>
&nbsp; &nbsp; makes sense - e.g. a primary nav bar). &nbsp;So I want to have "href"<br>
&nbsp; &nbsp; attributes that work in the templates. &nbsp;At the same time, I want the<br>
&nbsp; &nbsp; application to have the right value set on the href.<br>
<br>
&nbsp; &nbsp; Since the template code favors attributes in the template (and I<br>
&nbsp; &nbsp; agree it almost always should!) I figured I had two options. &nbsp;Either<br>
&nbsp; &nbsp; modify the templating code to *sometimes* prefer widget attributes<br>
&nbsp; &nbsp; over template attributes, or else find a way to remove the href<br>
&nbsp; &nbsp; attributes from the template.<br>
<br>
&nbsp; &nbsp; I thought about a "data-exclude-attributes" attribute in the<br>
&nbsp; &nbsp; template, but that didn't feel right.<br>
<br>
&nbsp; &nbsp; Instead, I simply removed all the hrefs from my template and<br>
&nbsp; &nbsp; replaced them with a tiny bit of on-document-load javascript that<br>
&nbsp; &nbsp; inserts them. This way, when the file is used as an Errai template,<br>
&nbsp; &nbsp; there's no 'href' attribute to get in the way. &nbsp;At the same time,<br>
&nbsp; &nbsp; when viewed directly in the browser, the templates still appear to<br>
&nbsp; &nbsp; have valid hrefs (because they get added by my little bit of JS code).<br>
<br>
&nbsp; &nbsp; Seems like a reasonable workaround, assuming there aren't too many<br>
&nbsp; &nbsp; static links. &nbsp;And I think in my applications there won't be too many.<br>
<br>
&nbsp; &nbsp; -Eric<br>
<br>
<br>
&nbsp; &nbsp; On 01/11/2013 12:22 PM, Lincoln Baxter wrote:<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; Hey Eric,<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; Thanks for getting in touch!<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; I'm sorry it took me so long to respond, I've been in fire<br>
&nbsp; &nbsp; &nbsp; &nbsp; fighting mode trying to get Forge ready for our big team meeting.<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; I've also copied my preferred email address and the errai-dev<br>
&nbsp; &nbsp; &nbsp; &nbsp; list, which are two places that will probably get a faster<br>
&nbsp; &nbsp; &nbsp; &nbsp; response from me, since I don't always have access to the VPN :)<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; The issue has already been resolved, but I agree with all of<br>
&nbsp; &nbsp; &nbsp; &nbsp; your changes. The attribute "whacking" can be problematic if you<br>
&nbsp; &nbsp; &nbsp; &nbsp; actually want to go the "other way."<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; Sorry again for the late reply. Feel free to email me personally<br>
&nbsp; &nbsp; &nbsp; &nbsp; (at home) and copy the dev list for best results :)<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; Thanks!<br>
&nbsp; &nbsp; &nbsp; &nbsp; ~Lincoln<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; ----- Original Message -----<br>
&nbsp; &nbsp; &nbsp; &nbsp; From: "Eric Wittmann" &lt;<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a><br></div></div><div class="im">
&nbsp; &nbsp; &nbsp; &nbsp; &lt;mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.<u></u>com</a>&gt;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; To: "Lincoln Baxter" &lt;<a href="mailto:lbaxter@redhat.com" target="_blank">lbaxter@redhat.com</a><br></div><div class="im">
&nbsp; &nbsp; &nbsp; &nbsp; &lt;mailto:<a href="mailto:lbaxter@redhat.com" target="_blank">lbaxter@redhat.com</a>&gt;&gt;, <a href="mailto:jfuerth@redhat.com" target="_blank">jfuerth@redhat.com</a><br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;mailto:<a href="mailto:jfuerth@redhat.com" target="_blank">jfuerth@redhat.com</a>&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; Sent: Wednesday, January 2, 2013 1:31:03 PM<br>
&nbsp; &nbsp; &nbsp; &nbsp; Subject: Errai navigation + templating discussion<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; Hey Lincoln. &nbsp;I'm in the JBoss middleware group, specifically<br>
&nbsp; &nbsp; &nbsp; &nbsp; working on<br>
&nbsp; &nbsp; &nbsp; &nbsp; the Overlord project. &nbsp;One of my responsibilities is producing a<br>
&nbsp; &nbsp; &nbsp; &nbsp; couple<br>
&nbsp; &nbsp; &nbsp; &nbsp; of UI applications. &nbsp;To that end, I've been digging Errai and<br>
&nbsp; &nbsp; &nbsp; &nbsp; hope to<br>
&nbsp; &nbsp; &nbsp; &nbsp; contribute back based on my project needs.<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; Ok, that's out of the way. &nbsp;:) &nbsp;I've been discussing a couple of<br>
&nbsp; &nbsp; &nbsp; &nbsp; Errai 3<br>
&nbsp; &nbsp; &nbsp; &nbsp; features with Jonathan (via github pull request comments :)).<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; One of<br>
&nbsp; &nbsp; &nbsp; &nbsp; these is a new injectable Transition widget in errai-navigation.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; You<br>
&nbsp; &nbsp; &nbsp; &nbsp; can see the pull request here:<br>
<br></div>
&nbsp; &nbsp; &nbsp; &nbsp; <a href="https://github.com/errai/__errai/pull/27" target="_blank">https://github.com/errai/__<u></u>errai/pull/27</a><div class="im"><br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;<a href="https://github.com/errai/errai/pull/27" target="_blank">https://github.com/errai/<u></u>errai/pull/27</a>&gt;<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; The goal was to really take out a lot of the boilerplate for the<br>
&nbsp; &nbsp; &nbsp; &nbsp; simple<br>
&nbsp; &nbsp; &nbsp; &nbsp; case of static hyperlinks from one @Page to another.<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; I think it works well except for one small issue (documented in the<br>
&nbsp; &nbsp; &nbsp; &nbsp; "What's Missing" section of the pull request).<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; Jonathan mentioned that you might have some thoughts about the<br>
&nbsp; &nbsp; &nbsp; &nbsp; templating issue, as it relates to attribute priority.<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; Any thoughts? &nbsp;I'd like the href to be preserved in this case<br>
&nbsp; &nbsp; &nbsp; &nbsp; because I<br>
&nbsp; &nbsp; &nbsp; &nbsp; would like the template's href to point to some local HTML file<br>
&nbsp; &nbsp; &nbsp; &nbsp; while<br>
&nbsp; &nbsp; &nbsp; &nbsp; the live application uses the proper history token as the href.<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; Thanks!<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; -Eric<br>
<br>
</div></blockquote>
</blockquote></div><br><br clear="all"><br>-- <br>Lincoln Baxter, III<br><a href="http://ocpsoft.org/" target="_blank">http://ocpsoft.org</a><br>"Simpler is better."
</div>
_______________________________________________<br>errai-dev mailing list<br><a href="mailto:errai-dev@lists.jboss.org">errai-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/errai-dev<br></blockquote></div><br></div></body></html>