I've got a simple custom widget designed to display two column data.
Any widgets I put in this custom widget can't fire events. I've tried
even the simplest Button and it fails. Is there something about the
nature of my widget that is keeping events from widgets it contains
from firing?
public class LabeledValueWidget extends Composite {
private String caption;
private Map<Widget, Widget> items = null;
private CaptionPanel container = new CaptionPanel();
private Style style;
static boolean isInjected = false;
public LabeledValueWidget () {
this.initWidget(container);
}
public void setItems (Map<Widget, Widget> items) {
this.items = items;
}
@Override
public void setStyleName (String styleName) {
super.setStyleName(styleName);
}
@Override
public void addStyleName (String styleName) {
super.addStyleName(styleName);
}
public void setCaption (String caption) {
this.caption = caption;
}
public void render() {
style = LabeledValueWidgetResource.INSTANCE.style();
if (!isInjected) {
isInjected = style.ensureInjected();
}
container.setCaptionText(caption);
Element dl = DOM.createElement("dl");
writeDefinitions (dl);
container.getElement().appendChild(dl);
}
public LabeledValueWidget (Map<Widget,Widget> items, String caption)
{
this.initWidget(container);
this.items = items;
render();
}
private void writeDefinitions (Element dl) {
for (Widget key: items.keySet()) {
Element dt = DOM.createElement("dt");
dt.addClassName(style.label());
dl.appendChild(dt);
Element label = DOM.createElement("label");
dt.appendChild(label);
label.appendChild(key.getElement());
Element dd = DOM.createElement("dd");
dd.addClassName(style.value());
dl.appendChild(dd);
dd.appendChild(items.get(key).getElement());
}
}
When I instantiate this and call setItems and pass it a map with
Label, Button and I've defined the button to have a click handler. The
click handler never gets fired ;(
--
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.