Another workaround which I have found is adding the Modal component to the RootPanel :
public AddClassDialogViewImpl() {
initWidget(uiBinder.createAndBindUi(this));
cancel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
//hide the widget
addClassModal.hide();
// unless you want to keep this modal as a singleton, you need to remove it from the DOM
RootPanel.get().remove(AddClassDialogViewImpl.this);
}
});
//add the widget to the DOM
RootPanel.get().add(this);
// show the widget
addClassModal.show();
}