Re: [gwt-contrib] Simple, inline actions in UiBinder
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
Re: [gwt-contrib] Simple, inline actions in UiBinder
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
Re: [gwt-contrib] Simple, inline actions in UiBinder
That custom parser would be great for now, thanks for the ideas. My understanding of UiBinder is woefully incomplete right now, so I'll need to dig into it a bit more to see how to do this. Thanks, Matt. On 2010-01-05, at 1:52 PM, Ray Cromwell 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
Re: [gwt-contrib] Simple, inline actions in UiBinder
Definitely agree with that statement: JSP files with entire blocks of Java code are usually an unreadable mess. All of the use-cases I could name are simple lists of actions that happen on elements somewhere within the current control. Some of the actions are more complex, such as GWTQuery-style transitions that require asynchronous callbacks, while others are synchronous CSS style or attribute changes. All of them are triggered by DOM events of some sort: click, mouseover, mouseout, focus, blur. The idea is to allow the large subset of basic functionality to be added at design time without involving developers in any way. I imagine a set of bindings for some basic events, plus a way to add bindings for other transitions specified elsewhere. I'm not proposing a syntax here, just an illustration of the level of control I'd imagine a designer to have: span ui:mouseover=gq:slideDown(answer, 10); ui:addClass({style.blink}); ui:mouseout=gq:slideUp(answer, 10);Peek at the answer/span div id=answer 42 /div Matt. On 2010-01-05, at 2:13 PM, Joel Webber 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