Please allow me to respectfully disagree. The notion that this is going to lead to awkward language constructs being bolted onto XML derives from the fallacious belief that this system is meant to behave like a template system, a la JSP. It's not -- it's really "just" a way to build widget/html constructs in XML in a way that is much simpler than doing the equivalent than Java. This is particularly important if speed is an important goal (it is). In no browser will it ever be faster to create a "widget" (or any similar abstraction) than an HTML element, especially if we know about a collection of them at once (read: innerHTML). And the difference is significant, sometimes by a large factor. On top of this, it is often *simpler* to express certain constructs in simple HTML (perhaps even copied and pasted from elsewhere) than the equivalent widget construct would have been. All told, there are a lot of advantages to using a mixture of HTML (where appropriate) and widgets, and a major goal of UiBinder is to enable this use-case.
Now don't get me wrong -- I truly hate XML. I think it's a bloated mess that starts with the goal of being human-readable and reasonably simple, and fails on both counts. But when you're working with the browser and HTML, it's the only game in town. On Sat, Oct 3, 2009 at 5:14 PM, SonyMathew <[email protected]> wrote: > > Good questions/suggestsion... > > The XML approach is very much going backwards in my opinion - it > reminds me of all the legacy web-frameworks - that i have been using > for the last 10 years. Essentially language constructs like "for > loops" and "if/else" are going to have some funky syntax in XML along > with funky binding expressions to Java fields. All this to > accommodate HTML elements like <div> and <span>? These concepts > should be abstracted in my opinion. GWT won't be able to mask browser > differences of HTML elements effectively with this approach either. > > I agree - JavaFx like syntax would have been perfect - otherwise Java > is just fine - the kind of Java/OO things I am doing now with GWT is > just not going to be possible with XML. I wish all that energy on > UIBinder would have been spent on better Java API and Widgets. > > On Sep 30, 4:14 am, [email protected] wrote: > > Comment by markovuksanovic: > > > > Could someone tell if it is possible to achieve something like (syntax is > > > definitely wrong but I hope you get the idea - it's more of a pseudo code > ) > > > > foreach (String s in stringList) > > <div class='{res.style.mainBlock}'> > > <div ui:apply='{res.style.userPictureSprite}'> > > Well hello there > > <ui:gwtLabel value={bind to s} /> > > </div> > > </div> > > end foreach > > > > I've seen that it possible to define a filed of for example list and then > > > in java class add items to that field.. but I would prefer something like > > > above - to have a loop which would generate widgets and bind there > property > > to a value. > > > > For more information: > http://code.google.com/p/google-web-toolkit/wiki/UiBinder > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
