public class NewRegAuthAlert extends FlowPanel {
public NewRegAuthAlert() {
String html = "For addmin comments please <div id=\"login2\">sign in</div> or register";
add(new HTML(html));
}
protected void onLoad() {
Label.wrap(DOM.getElementById("login2")).addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
Window.alert("alert message");
}
});
}
}
In dev mode this doesn't work.
java.lang.AssertionError: A widget that has an existing parent widget may not be added to the detach list
at com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose(RootPanel.java:136)
at com.google.gwt.user.client.ui.Label.wrap(Label.java:130)
But when compiled works fine. Please help.