Hi,
I need to create lots (hundreds) of image tags, and attach them
dynamically to several plain <div class="xy"></div> elements:
<div class="xy">
<img src="images/a.gif" style="top: 1em;"/>
<img src="images/a.gif" style="top: 2em;"/>
<img src="images/b.gif" style="top: 3em;"/>
...
</div>
...
The <img> tags can have only two different src urls. But each needs
individual style attributes (for absolute positioning).
Question:
What would be the fastest (and preferably clean) way to do that?
A) GwtQuery (aka GQuery)?
B) UiBinder?
C) Other?
----
A) The GwtQuery approach:
As a first pretty clueless attempt, I'm currently using GwtQuery code
similar to this:
@UiField
HTML div1;
void attachImages(...) {
for (...) {
$(div1.getElement()).append(
"<img src='images/" + (flag ? "a" : "b") + ".gif' style='top:"
+ i + "em'/>");
}
}
@UiHandler("div1")
void onDivClicked(final ClickEvent event) {
...
}
This works, but a) it's obviously ugly, and b) I don't know, if
there's a faster/better way.
----
B) The UiBinder approach:
I chose the HTML class, to get a clean div, and still be able to use
@UiHandler. But it doesn't seem to be possible to attach (UiBinder)
Composites to it. What else should I choose? Unfortunately, HTMLPanel
isn't a subclass of HasClickHandlers, so it doesn't work with
@UiHandler.
----
C) Other approaches:
?
Thanks
Chris
--
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.