<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Jonathan and I discussed the benefits of the extra 2 annotations a couple of hours ago.</div><div><br></div><div>With the latest changes I just pushed we have the following benefits using our new approach:</div><div><br></div><div>-) Since @DataFields are no longer bound by default (only if marked as @Bound) we no longer have to tolerate bindings to non-existing properties. A binding to a non-existing property in errai-ui now fails at compilation/generation time.&nbsp;</div><div><br></div><div>-) Using the programmatic data-binding API, we can now throw an exception if a user calls binder.bind(widget, "non-existing") at runtime.</div><div><br></div><div>-) We now support having multiple data binders in a @Templated class, as long as there's only one @AutoBound data binder.</div><div><br></div><div>-) It's a lot easier to understand what's going on by just reading the code.</div><div><br></div><div>-) And of course we have a way to specify the property we want to bind to as well as a converter class (we would have had to add an additional annotation for this anyway).</div><div><br></div><div>So, in short I think the extra 2 annotations are justified (at least that's what I keep telling myself :)).</div><div><br></div><div>Cheers,</div><div>Christian</div><br><div><div>On 2012-08-14, at 4:01 PM, Christian Sadilek &lt;<a href="mailto:csadilek@redhat.com">csadilek@redhat.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">This is implemented now.<div><br></div><div>Here's an example from the errai-ui test suite:</div><div><a href="https://github.com/errai/errai/blob/master/errai-ui/src/test/java/org/jboss/errai/ui/test/binding/client/res/BindingTemplate.java">https://github.com/errai/errai/blob/master/errai-ui/src/test/java/org/jboss/errai/ui/test/binding/client/res/BindingTemplate.java</a></div><div><br></div><div>It shows how to use converters and how to bind to alternative properties.</div><div><br></div><div>Could you give it a try by adapting your demos and see if you still like the approach before we document and release it?</div><div><br></div><div>Cheers,</div><div>Christian</div><div><br><div><div>On 2012-08-14, at 3:48 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">Agreed, +1 for @Bound - and someone needs to fix this list to reply-all by default. I'll try.<br><br><div class="gmail_quote">On Tue, Aug 14, 2012 at 10:44 AM, Jonathan Fuerth <span dir="ltr">&lt;<a href="mailto:jfuerth@redhat.com" target="_blank">jfuerth@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-size:12pt;font-family:times new roman,new york,times,serif">Me too. I understand that @Inject is an imperative verb, but maybe that was a mistake in a spec we don't control. :)<div>
<br></div><div>The good news is that it reads well whether or not @Inject is also present:</div><div class="im"><div><br></div><div>@Inject @Bound private TextBox input;</div></div><div><div>@Bound private TextBox input = new TextBox("moo");</div>
<div><br></div>-Jonathan</div><div><br></div><div>PS: sorry for the earlier reply which didn't make it to the list.. I had tried to respond to the list from an account that isn't subscribed to this list.<br><hr><div style="font-size:12pt;font-style:normal;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal">
<div class="im"><b>From: </b>"Lincoln Baxter, III" &lt;<a href="mailto:lincolnbaxter@gmail.com" target="_blank">lincolnbaxter@gmail.com</a>&gt;<br></div><b>To: </b>"Christian Sadilek" &lt;<a href="mailto:csadilek@redhat.com" target="_blank">csadilek@redhat.com</a>&gt;<br>
<b>Cc: </b><a href="mailto:errai-dev@lists.jboss.org" target="_blank">errai-dev@lists.jboss.org</a>, "Mike Brock" &lt;<a href="mailto:brockm@gmail.com" target="_blank">brockm@gmail.com</a>&gt;, "Jonathan Fuerth" &lt;<a href="mailto:jfuerth@gmail.com" target="_blank">jfuerth@gmail.com</a>&gt;<br>
<b>Sent: </b>Monday, August 13, 2012 1:37:04 PM<br><b>Subject: </b>Re: [errai-dev] Fwd: Errai UI and DataBinding<div><div class="h5"><br><br>I'm still leaning toward @Bound<br><br><div class="gmail_quote">On Mon, Aug 13, 2012 at 1:12 PM, Christian Sadilek <span dir="ltr">&lt;<a href="mailto:csadilek@redhat.com" target="_blank">csadilek@redhat.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I agree that AutoBound is better, so the remaining question is just @Bind vs. @Bound for DataFields?<div>

<br></div><div><blockquote><span style="font-size:large;font-family:'courier new',monospace">As adjectives:</span></blockquote><blockquote><div><span style="font-family:'courier new',monospace"><br>
@Templated</span><br style="font-family:'courier new',monospace"><span style="font-family:'courier new',monospace">public class Thing extends Composite {</span><br style="font-family:'courier new',monospace">

<br style="font-family:'courier new',monospace"><span style="font-family:'courier new',monospace">&nbsp; @Inject</span><br style="font-family:'courier new',monospace"></div><span style="font-family:'courier new',monospace">&nbsp; @Bound</span><span style="font-family:'courier new',monospace">(property="street")</span></blockquote>

<blockquote><span style="font-family:'courier new',monospace">&nbsp; @DataField</span><br style="font-family:'courier new',monospace"><span style="font-family:'courier new',monospace">&nbsp; private TextBox input;</span><br style="font-family:'courier new',monospace">

</blockquote><br><blockquote><font face="courier new, monospace">&nbsp; or</font></blockquote><br><div><blockquote><span style="font-family:'courier new',monospace">&nbsp; @Inject</span><br style="font-family:'courier new',monospace">

<span style="font-family:'courier new',monospace">&nbsp; @Bind(property="street")</span></blockquote><blockquote><span style="font-family:'courier new',monospace">&nbsp; @DataField</span><br style="font-family:'courier new',monospace">

<span style="font-family:'courier new',monospace">&nbsp; private TextBox input;</span></blockquote></div><div><blockquote><br style="font-family:'courier new',monospace"><span style="font-family:'courier new',monospace">}</span></blockquote>

<div><br></div><div><br><div><div>On 2012-08-13, at 12:54 PM, "Lincoln Baxter, III" &lt;<a href="mailto:lincolnbaxter@gmail.com" target="_blank">lincolnbaxter@gmail.com</a>&gt; wrote:</div><br><blockquote>
<span style="font-family:courier new,monospace"><font size="4"><font><span style="font-family:arial,helvetica,sans-serif">I'm
 voting for adjectives I guess. It's typically the way that CDI 
Qualifiers look when functioning with @Inject. Granted, these aren't 
qualifiers, but they might as well be by how they behave and actually 
modify the result of the injection.<br>
<br>I'm 100% sure how I feel about @AutoBound - but I'm not 100% sure about @Bound.<br></span><br><br></font>As adjectives:</font><br><br><span style="font-family:courier new,monospace">@Templated</span></span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">public class Thing extends Composite {</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">&nbsp; @Inject</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">&nbsp; @Bound</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">&nbsp; private TextBox input;</span><br style="font-family:courier new,monospace">



<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">&nbsp; @Inject</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">&nbsp; @AutoBound</span><br style="font-family:courier new,monospace">



<span style="font-family:courier new,monospace">&nbsp; private DataBinder&lt;Model&gt; binder;</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">}</span><br>



<br><br><span style="font-family:courier new,monospace"><font size="4">As verbs:</font><br><br>
@Templated</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">public class Thing extends Composite {</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
&nbsp; @Inject</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
&nbsp; @Bind</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
&nbsp; private TextBox input;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
&nbsp; @Inject</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
&nbsp; @AutoBind</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
&nbsp; private DataBinder&lt;Model&gt; binder;</span><div><img src="https://mail.google.com/mail/u/0/images/cleardot.gif"></div><br style="font-family:courier new,monospace">

<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">}</span><br><br><div class="gmail_quote">On Mon, Aug 13, 2012 at 11:31 AM, Christian Sadilek <span dir="ltr">&lt;<a href="mailto:csadilek@redhat.com" target="_blank">csadilek@redhat.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Had the same thought. It's @Inject, so I thought @Bind would be more consistent on the data field….but I am fine either way…let's vote :)<div>


<div><br><div><div>On 2012-08-13, at 11:26 AM, "Lincoln Baxter, III" &lt;<a href="mailto:lincolnbaxter@gmail.com" target="_blank">lincolnbaxter@gmail.com</a>&gt; wrote:</div><br><blockquote>
Should it be @Bind or @Bound?<br><br><div class="gmail_quote">On Mon, Aug 13, 2012 at 10:52 AM, Christian Sadilek <span dir="ltr">&lt;<a href="mailto:christian.sadilek@gmail.com" target="_blank">christian.sadilek@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">just forwarding Lincoln's reply. If there are no objections to @Bind<br>
and @AutoBound, I will go ahead and implement this later today or<br>
tomorrow.<br>
<br>
cheers,<br>
christian<br>
<div><br>
---------- Forwarded message ----------<br>
From: Lincoln Baxter, III &lt;<a href="mailto:lincolnbaxter@gmail.com" target="_blank">lincolnbaxter@gmail.com</a>&gt;<br>
Date: Mon, Aug 13, 2012 at 12:05 AM<br>
Subject: Re: [errai-dev] Errai UI and DataBinding<br>
To: Christian Sadilek &lt;<a href="mailto:christian.sadilek@gmail.com" target="_blank">christian.sadilek@gmail.com</a>&gt;<br>
<br>
<br>
I do think we need programmatic control over bindings. I think that<br>
was one of my first questions when we implemented the @Injected<br>
databinder. I agree with you that the current state is a bit too<br>
"magical," and I think that the suggestions you've brough up will help<br>
to eliminate that.<br>
<br>
+1 to individual @Bind and also aggregate @Autobind / @Autobound annotation<br>
<br>
~Lincoln<br>
<br>
On Sun, Aug 12, 2012 at 7:53 PM, Christian Sadilek<br>
&lt;<a href="mailto:christian.sadilek@gmail.com" target="_blank">christian.sadilek@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I'd like to propose a change to our DataBinding integration in Errai<br>
&gt; UI. Basically, I think we should retire the implicit binding approach<br>
&gt; and introduce a new annotation. So, within a @Templated class that has<br>
&gt; a DataBinder&lt;T&gt; field, we should have the following options:<br>
&gt;<br>
&gt; 1. No binding<br>
&gt; @Inject @DataField<br>
&gt; private TextBox date;<br>
&gt;<br>
&gt; 2. Binding to model property with matching name<br>
&gt; @Inject @Bind @DataField<br>
&gt; private TextBox date;<br>
&gt;<br>
&gt; 3. Binding to model property with matching name using provided converter<br>
&gt; @Inject @Bind(converter=MyDataConverter.class) @DataField<br>
&gt; private TextBox date;<br>
&gt;<br>
&gt; 4. Binding to model property with provided name<br>
&gt; @Inject @Bind(property="lastUpdated") @DataField<br>
&gt; private TextBox date;<br>
&gt;<br>
&gt; 5. Binding to model property with provided name using provided converter<br>
&gt; @Inject @Bind(property="lastUpdated", converter=MyDataConverter.class)<br>
&gt; @DataField<br>
&gt; private TextBox date;<br>
&gt;<br>
&gt; Additionally, we could add an annotation (e.g. @AutoBind) that when<br>
&gt; present on the @Templated class causes our current behaviour. All<br>
&gt; @DataFields will be bound to model properties with matching names.<br>
&gt;<br>
&gt; I prefer this approach because just by looking at the code I get all<br>
&gt; the information I need to undersand what's going on. Our current<br>
&gt; approach seems a little too magical :).<br>
&gt;<br>
&gt; WDYT?<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Christian<br>
&gt; _______________________________________________<br>
&gt; errai-dev mailing list<br>
&gt; <a href="mailto:errai-dev@lists.jboss.org" target="_blank">errai-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/errai-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/errai-dev</a><br>
<br>
<br>
<br>
<br>
--<br>
Lincoln Baxter, III<br>
<a href="http://ocpsoft.org/" target="_blank">http://ocpsoft.org</a><br>
"Simpler is better."<br>
_______________________________________________<br>
errai-dev mailing list<br>
<a href="mailto:errai-dev@lists.jboss.org" target="_blank">errai-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/errai-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/errai-dev</a><br>
</div></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."<br>
_______________________________________________<br>errai-dev mailing list<br><a href="mailto:errai-dev@lists.jboss.org" target="_blank">errai-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/errai-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/errai-dev</a><br>


</blockquote></div><br></div></div></div></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."<br>



</blockquote></div><br></div></div></div></div></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."<br>


<br>_______________________________________________<br>errai-dev mailing list<br><a href="mailto:errai-dev@lists.jboss.org" target="_blank">errai-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/errai-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/errai-dev</a><br>
</div></div></div><br></div></div></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."<br>
</blockquote></div><br></div></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></body></html>