On 26 août, 10:18, samsus <[email protected]> wrote:
> Hi Everyone,
>
> This past week i have been working on a project where the project is
> in php, it has diferent php pages, and im using gwt as a javascript/
> jquery substitute, specially for forms.
>
> The problem im getting with gwt-created forms is that, the designer
> doesnt seem to have control over it.
>
> With normal html + jquery there would be a html form, the design could
> style it anyway he wanted, and put it inside tables, or some neat css
> divs and fieldsets, and i would simply apply jquery over it for the
> widgets i need (e.g autocomplete) or validations.
> In GWT however, the entire form is generated by Java, and in resulting
> code the fields of the form are inside messy tables.

It all depends which widgets you use for the layout; FlowPanel for
example is a simple <div>...

> further, if the
> designer wants to change , say, something as simple as the order of
> two text boxes, he has to edit the java code, which is not a good
> pratice.
>
> Anybody knows a "smarter" way to do this?

Several solutions:
 - don't build your form with GWT and instead wrap GWT widgets around
existing HTML elements:
      TextBox myBox = TextBox.wrap(Document.get().getElementById("my-
box"));
   i.e. use progressive enhancement as you were used to with jQuery.
And if you want a jQuery-like approach to get elements, have a look a
GQuery: http://code.google.com/p/gwtquery/
   (beware: you cannot wrap nested elements; well, actually, you can,
at your own risks; either disable assertions in hosted mode and/or see
issue 3528)
 - use an HTMLPanel with placeholders where you'll inject your GWT
widgets (there's no HTMLPanel.wrap() but it could be somehow
simulated:
      RootPanel rootPanel = RootPanel.get("thingToWrap");
      HTMLPanel panel = new HTMLPanel(rootPanel.getElement
().getInnerHTML());
      rootPanel.getElement().setInnerHTML(null);
      rootPanel.add(panel);
   it'll add a <div> –or whatever "ag" you passed as the second
argument to HTMLPanel's ctor– in between the "root panel" element and
its children as they appeared originally in the HTML code)
 - use UiBinder that'll ship in the upcoming GWT 2.0

I'd personally favor UiBinder if possible.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to