Some of this could be done just by using declaration meta-data plus
meta-data triggering, for example:

<span fx:"slideDown">Hello</span>

and then in Java code, something like

public void hasSlideDown(Element e,, String value) {
    // wire up animations
}

The idea is that one can introduce declaration annotations and then
centralize the handling of those in one spot, decoupling the
declaration from the implementation code, otherwise, anyone who wants
to assert something like slideDown would have to go into the init code
and wire up the injected element directly.

This could also work for class attributes too:

public void hasActionLearnMore(Element e) {
 // called for every element which has actionLearnMore class
}

it's like a compile-time CSS application.


On Tue, Jan 5, 2010 at 1:13 PM, Joel Webber <j...@google.com> wrote:
> I've generally been somewhat opposed to the idea of "little languages"
> creeping into UiBinder code, because it's much harder to provide tools to
> help with the code. But I can also see the utility of something like this.
> If we're to address this problem, we should do some thinking about how best
> to provide a sensible set of restrictions (i.e. not all of Java) that
> encourage people to do more complex things in normal Java code. We should
> also be thinking about how best to make this work with whatever "binding"
> framework we decide to use.
> On Tue, Jan 5, 2010 at 3:52 PM, Ray Cromwell <cromwell...@gmail.com> wrote:
>>
>> Great idea, I was thinking of having something like
>> <ui:query></ui:query> and use $("id") to wire up stuff, but this is
>> even better since you avoid the lazy() or anonymous inner class.  The
>> alternative is to have a custom parser like
>>
>> <gq:query>
>> $(".actionLearnMore a").click(lazy().as(Effects).slideToggle().end());
>> </gq:query>
>>
>> This could be simplified further for callback actions:
>> <gq:click query=".actionLearnMore a">
>> as(Effects().slideToggle();
>> </gq:action>
>>
>> -Ray
>>
>> On Tue, Jan 5, 2010 at 12:42 PM, Matt Mastracci <matt...@mastracci.com>
>> wrote:
>> > Hey all,
>> >
>> > I've been playing around with UiBinder, hoping to start replacing a lot
>> > of our custom templating code with it. One feature that would really 
>> > improve
>> > the experience for our designer/developer interface would be inline 
>> > actions.
>> >
>> > A lot of our boilerplate UI event code does one of the of the following:
>> >
>> >  - hides/shows/toggles another element (ie: expando links)
>> >  - adds/removes/toggers a CSS classname
>> >  - starts an animation
>> >  - changes a rollover image
>> >
>> > It would be really useful if there was a way to plug in actions inline,
>> > something like the following pseudo-gwtquery code:
>> >
>> > <span class="actionLearnMore">
>> >        <a title="Learn more about dots"
>> > ui:click='${"infoBox"}.as(Effects).slideToggle()'>Learn more</a>
>> >
>> >        <div id="infoBox">
>> >                More info...
>> >        </div>
>> > </span>
>> >
>> > I don't know what the ideal syntax would look like, but even something
>> > trivial would be able to replace 99% of the UI event code we have to write.
>> >
>> > Thoughts?
>> > Matt.
>> >
>> >
>> > --
>> > http://groups.google.com/group/Google-Web-Toolkit-Contributors
>> >
>>
>> --
>> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>
>
> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>
-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to