<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; "> addAttachHandler(<span style="color: rgb(147, 26, 104); ">new</span> Handler() {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(119, 119, 119); "><span style="color: rgb(0, 0, 0); "> </span>@Override</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "> <span style="color: rgb(147, 26, 104); ">public</span> <span style="color: rgb(147, 26, 104); ">void</span> onAttachOrDetach(AttachEvent event) {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><div style="margin: 0px; "> <span style="color: rgb(78, 144, 114); ">//change attributes</span></div></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "> } </div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "> });</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, <span style="color: rgb(147, 26, 104); ">final</span> Class<P> toPage) {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "> ...</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "> 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"> </span>@Override</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "> <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; "> initHref(toPage);</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "> } </div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "> });</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" <<a href="mailto:lincolnbaxter@gmail.com">lincolnbaxter@gmail.com</a>> 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"><<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a>></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. I agree that care is needed, though. :)<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>
@Templated(<br>
value="artifacts.html#page",<br>
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>
* All href attributes<br>
* The id attribute on button elements<br>
* The src attribute on any element with class=help-icon<br>
* The class attribute on the element with id=breadcrumbs<br>
<br>
Support could exist only for the spec:<br>
<br>
<element>[.#]<classOrId>@<<u></u>attribute><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" <<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a><br></div><div><div class="h5">
<mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.<u></u>com</a>>> wrote:<br>
<br>
No worries, Lincoln. Good luck with the Forge stuff. :)<br>
<br>
As for the remaining attribute issue, I came up with an acceptable<br>
workaround. As I mentioned in the pull request, I want the live<br>
preview/templates to be as functional as possible, including the<br>
ability to navigate around the different pages (statically when that<br>
makes sense - e.g. a primary nav bar). So I want to have "href"<br>
attributes that work in the templates. At the same time, I want the<br>
application to have the right value set on the href.<br>
<br>
Since the template code favors attributes in the template (and I<br>
agree it almost always should!) I figured I had two options. Either<br>
modify the templating code to *sometimes* prefer widget attributes<br>
over template attributes, or else find a way to remove the href<br>
attributes from the template.<br>
<br>
I thought about a "data-exclude-attributes" attribute in the<br>
template, but that didn't feel right.<br>
<br>
Instead, I simply removed all the hrefs from my template and<br>
replaced them with a tiny bit of on-document-load javascript that<br>
inserts them. This way, when the file is used as an Errai template,<br>
there's no 'href' attribute to get in the way. At the same time,<br>
when viewed directly in the browser, the templates still appear to<br>
have valid hrefs (because they get added by my little bit of JS code).<br>
<br>
Seems like a reasonable workaround, assuming there aren't too many<br>
static links. And I think in my applications there won't be too many.<br>
<br>
-Eric<br>
<br>
<br>
On 01/11/2013 12:22 PM, Lincoln Baxter wrote:<br>
<br>
Hey Eric,<br>
<br>
Thanks for getting in touch!<br>
<br>
I'm sorry it took me so long to respond, I've been in fire<br>
fighting mode trying to get Forge ready for our big team meeting.<br>
<br>
I've also copied my preferred email address and the errai-dev<br>
list, which are two places that will probably get a faster<br>
response from me, since I don't always have access to the VPN :)<br>
<br>
The issue has already been resolved, but I agree with all of<br>
your changes. The attribute "whacking" can be problematic if you<br>
actually want to go the "other way."<br>
<br>
Sorry again for the late reply. Feel free to email me personally<br>
(at home) and copy the dev list for best results :)<br>
<br>
Thanks!<br>
~Lincoln<br>
<br>
----- Original Message -----<br>
From: "Eric Wittmann" <<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a><br></div></div><div class="im">
<mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.<u></u>com</a>>><br>
To: "Lincoln Baxter" <<a href="mailto:lbaxter@redhat.com" target="_blank">lbaxter@redhat.com</a><br></div><div class="im">
<mailto:<a href="mailto:lbaxter@redhat.com" target="_blank">lbaxter@redhat.com</a>>>, <a href="mailto:jfuerth@redhat.com" target="_blank">jfuerth@redhat.com</a><br>
<mailto:<a href="mailto:jfuerth@redhat.com" target="_blank">jfuerth@redhat.com</a>><br>
Sent: Wednesday, January 2, 2013 1:31:03 PM<br>
Subject: Errai navigation + templating discussion<br>
<br>
Hey Lincoln. I'm in the JBoss middleware group, specifically<br>
working on<br>
the Overlord project. One of my responsibilities is producing a<br>
couple<br>
of UI applications. To that end, I've been digging Errai and<br>
hope to<br>
contribute back based on my project needs.<br>
<br>
Ok, that's out of the way. :) I've been discussing a couple of<br>
Errai 3<br>
features with Jonathan (via github pull request comments :)).<br>
One of<br>
these is a new injectable Transition widget in errai-navigation.<br>
You<br>
can see the pull request here:<br>
<br></div>
<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>
<<a href="https://github.com/errai/errai/pull/27" target="_blank">https://github.com/errai/<u></u>errai/pull/27</a>><br>
<br>
The goal was to really take out a lot of the boilerplate for the<br>
simple<br>
case of static hyperlinks from one @Page to another.<br>
<br>
I think it works well except for one small issue (documented in the<br>
"What's Missing" section of the pull request).<br>
<br>
Jonathan mentioned that you might have some thoughts about the<br>
templating issue, as it relates to attribute priority.<br>
<br>
Any thoughts? I'd like the href to be preserved in this case<br>
because I<br>
would like the template's href to point to some local HTML file<br>
while<br>
the live application uses the proper history token as the href.<br>
<br>
Thanks!<br>
<br>
-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>