PDA

View Full Version : Window.hide() throwing expection after migration from GXT2.1.1 to GXT2.2.1



soumya.chatterjee
21 Dec 2010, 5:39 AM
Following code was workin in GXT2.1.1 with GWT 2.0.3

try { display.getWindow().hide();
} catch (Exception e)
{
com.google.gwt.user.client.Window.alert("Exception:"+ e.getMessage());
}
The same code is not working in GXT2.2.1 with GWT 2.0.3

Exception it is giving is "This widgets parent doesnot implement HasWidgets".We did Some more analysis and found out the following difference in the Hide() method implementation in GXT2.1.1 and in GXT 2.2.1. Can anyone please suggest what needs to be changed.

sven
21 Dec 2010, 5:42 AM
How does your code look like? Where are you adding your window into?

soumya.chatterjee
21 Dec 2010, 5:55 AM
i am adding a window as a modal which should be hidden on a button event. It was working absolutely fine in GXT2.1.1 but throwing an exception in GXT2.2.1.
Provinding a code excerpt below,

public class LoginPresenter extends MainWidgetPresenter<LoginPresenter.Display> {
private static DispatchAsync dispatcher;
private static Display displayStatic;

@Inject
public LoginPresenter(final Display display, final EventBus eventbus, final DispatchAsync dispatcher,
final HomePresenter homePresenter,
final DesktopPresenter desktopPresenter,
final ResetPassPresenter resetPassPresenter,
final ForgetPassPresenter forgetPassPresenter,
final SecurityPresenter securityPresenter) {
super(display, eventbus);
LoginPresenter.dispatcher = dispatcher;
LoginPresenter.displayStatic = display;
this.dispatcher = dispatcher;
bind();
}
@Override
protected void onBind() {
display.login().addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent be) {
try {
dispatcher.execute(new Login(moUserInfo), new DisplayCallback<LoginResult>(display) {
@Override
protected void handleSuccess(LoginResult value) {
com.google.gwt.user.client.Window.alert("Inside handleSuccess 1");
////Window.alert("Hi---" + value.getUserInfo().getReturnMsg());
if ("111".equalsIgnoreCase(value.getUserInfo().getReturnCode())) {
com.google.gwt.user.client.Window.alert("Inside handleSuccess 6");
com.google.gwt.user.client.Window.alert("Inside handleSuccess 66" + display);
com.google.gwt.user.client.Window.alert("Inside handleSuccess 66" + display.getWindow());

try {
display.getWindow().hide();
} catch (Exception e) {
com.google.gwt.user.client.Window.alert("Exception:"+ e.getMessage());
}
} else {
}
}
@Override
protected void handleFailure(Throwable e) {
//Window.alert("handleFailure---");
}
});
} catch (Exception ex) {
//Window.alert("ex---" + ex.getMessage());
}
}
});
}
@Override
protected void onUnbind() {
}
@Override
public Place getPlace() {
return new Place("Login");
}
@Override
protected void onPlaceRequest(PlaceRequest request) {
}
public void refreshDisplay() {
}
public void revealDisplay() {
}
public interface Display extends WidgetDisplay {
public com.extjs.gxt.ui.client.widget.Window getWindow();
}


}