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 <lincolnbaxter(a)gmail.com>
Date: Mon, Aug 13, 2012 at 12:05 AM
Subject: Re: [errai-dev] Errai UI and DataBinding
To: Christian Sadilek <christian.sadilek(a)gmail.com>
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
<christian.sadilek(a)gmail.com> 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
errai-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/errai-dev
--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."