This is implemented now. Here's an example from the errai-ui test suite: https://github.com/errai/errai/blob/master/errai-ui/src/test/java/org/jboss/errai/ui/test/binding/client/res/BindingTemplate.java
It shows how to use converters and how to bind to alternative properties. Could you give it a try by adapting your demos and see if you still like the approach before we document and release it? Cheers, Christian On 2012-08-14, at 3:48 PM, "Lincoln Baxter, III" <[email protected]> wrote: > Agreed, +1 for @Bound - and someone needs to fix this list to reply-all by > default. I'll try. > > On Tue, Aug 14, 2012 at 10:44 AM, Jonathan Fuerth <[email protected]> wrote: > Me too. I understand that @Inject is an imperative verb, but maybe that was a > mistake in a spec we don't control. :) > > The good news is that it reads well whether or not @Inject is also present: > > @Inject @Bound private TextBox input; > @Bound private TextBox input = new TextBox("moo"); > > -Jonathan > > 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. > From: "Lincoln Baxter, III" <[email protected]> > To: "Christian Sadilek" <[email protected]> > Cc: [email protected], "Mike Brock" <[email protected]>, "Jonathan > Fuerth" <[email protected]> > Sent: Monday, August 13, 2012 1:37:04 PM > Subject: Re: [errai-dev] Fwd: Errai UI and DataBinding > > > I'm still leaning toward @Bound > > On Mon, Aug 13, 2012 at 1:12 PM, Christian Sadilek <[email protected]> > wrote: > I agree that AutoBound is better, so the remaining question is just @Bind vs. > @Bound for DataFields? > > As adjectives: > > @Templated > public class Thing extends Composite { > > @Inject > @Bound(property="street") > @DataField > private TextBox input; > > or > > @Inject > @Bind(property="street") > @DataField > private TextBox input; > > } > > > On 2012-08-13, at 12:54 PM, "Lincoln Baxter, III" <[email protected]> > wrote: > > 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. > > I'm 100% sure how I feel about @AutoBound - but I'm not 100% sure about > @Bound. > > > As adjectives: > > @Templated > public class Thing extends Composite { > > @Inject > @Bound > private TextBox input; > > @Inject > @AutoBound > private DataBinder<Model> binder; > > } > > > As verbs: > > @Templated > public class Thing extends Composite { > > @Inject > @Bind > private TextBox input; > > @Inject > @AutoBind > private DataBinder<Model> binder; > > > > } > > On Mon, Aug 13, 2012 at 11:31 AM, Christian Sadilek <[email protected]> > wrote: > 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 :) > > On 2012-08-13, at 11:26 AM, "Lincoln Baxter, III" <[email protected]> > wrote: > > Should it be @Bind or @Bound? > > On Mon, Aug 13, 2012 at 10:52 AM, Christian Sadilek > <[email protected]> wrote: > just forwarding Lincoln's reply. If there are no objections to @Bind > and @AutoBound, I will go ahead and implement this later today or > tomorrow. > > cheers, > christian > > ---------- Forwarded message ---------- > From: Lincoln Baxter, III <[email protected]> > Date: Mon, Aug 13, 2012 at 12:05 AM > Subject: Re: [errai-dev] Errai UI and DataBinding > To: Christian Sadilek <[email protected]> > > > I do think we need programmatic control over bindings. I think that > was one of my first questions when we implemented the @Injected > databinder. I agree with you that the current state is a bit too > "magical," and I think that the suggestions you've brough up will help > to eliminate that. > > +1 to individual @Bind and also aggregate @Autobind / @Autobound annotation > > ~Lincoln > > On Sun, Aug 12, 2012 at 7:53 PM, Christian Sadilek > <[email protected]> wrote: > > > > Hi, > > > > I'd like to propose a change to our DataBinding integration in Errai > > UI. Basically, I think we should retire the implicit binding approach > > and introduce a new annotation. So, within a @Templated class that has > > a DataBinder<T> field, we should have the following options: > > > > 1. No binding > > @Inject @DataField > > private TextBox date; > > > > 2. Binding to model property with matching name > > @Inject @Bind @DataField > > private TextBox date; > > > > 3. Binding to model property with matching name using provided converter > > @Inject @Bind(converter=MyDataConverter.class) @DataField > > private TextBox date; > > > > 4. Binding to model property with provided name > > @Inject @Bind(property="lastUpdated") @DataField > > private TextBox date; > > > > 5. Binding to model property with provided name using provided converter > > @Inject @Bind(property="lastUpdated", converter=MyDataConverter.class) > > @DataField > > private TextBox date; > > > > Additionally, we could add an annotation (e.g. @AutoBind) that when > > present on the @Templated class causes our current behaviour. All > > @DataFields will be bound to model properties with matching names. > > > > I prefer this approach because just by looking at the code I get all > > the information I need to undersand what's going on. Our current > > approach seems a little too magical :). > > > > WDYT? > > > > Cheers, > > Christian > > _______________________________________________ > > errai-dev mailing list > > [email protected] > > https://lists.jboss.org/mailman/listinfo/errai-dev > > > > > -- > Lincoln Baxter, III > http://ocpsoft.org > "Simpler is better." > _______________________________________________ > errai-dev mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/errai-dev > > > > -- > Lincoln Baxter, III > http://ocpsoft.org > "Simpler is better." > _______________________________________________ > errai-dev mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/errai-dev > > > > > -- > Lincoln Baxter, III > http://ocpsoft.org > "Simpler is better." > > > > > -- > Lincoln Baxter, III > http://ocpsoft.org > "Simpler is better." > > _______________________________________________ > errai-dev mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/errai-dev > > > > > -- > Lincoln Baxter, III > http://ocpsoft.org > "Simpler is better."
_______________________________________________ errai-dev mailing list [email protected] https://lists.jboss.org/mailman/listinfo/errai-dev
