Tuesday 15 January 2013

GWT Widget from HTML -


I have a block of HTML that I want to use as the basis of the GWT widget, but I'm not sure That's the best way to do this, for example, my HTML block looks like this:

  & lt; Div class = "my-widget" & gt; & Lt; Div class = "header" & gt; & Lt; Span class = "title" & gt; Title Text & lt; / Span & gt; & Lt; / Div & gt; & Lt; Div class = "body" & gt; & Lt; Span class = "content" & gt; Content text & lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

Now, I can paste it into a HTML widget as a static string, but in this case I have the ability to set the text of "title" and "content" elements On the flight is required. This kills the static text option (or at least makes it much more difficult).

The first thing in that case is that it is necessary to manually construct elements in GWT and catch the context of those people who need to change, such as:

 < Code> DivElement container = document.createDivElement (); SetStyleName (container, "my-widget"); SetElement (container); DivElement Header = document.createDivElement (); SetStyleName (header, "header"); Container.appendChild (header); // Hold this element for later manipulation DivElement title = document.createDivElement (); SetStyleName (title, "title"); Header.appendChild (title);  

But it becomes easily unbearable for everyone, but the simplest of the layout (which is not mine).

What do I need to do to get this HTML The ability to send static text and then some sort of selector, such as jQuery, to query those elements that I want to manipulate, I know about it, but I have to get it to run without error Has not been able, and me That it may be easier to integrate into a commercial product soon in my life. P>

I also know about Google, what I really want to do. The problem is, as far as I can tell, this procedure is only available in GW 2.0, which is still a release candidate in the state and therefore can not be used for me.

So, given all this (sorry for the long question!) Do you have any suggestions on how to achieve something like this?

GWT 2.0 will be out before the end of the year so unless you distribute it in a few days time I do not need to, I start working with RC2 and am trying to get a new UIBinder approach.


No comments:

Post a Comment