我得到了一个登录窗口,根据RPC响应,它将显示另一个窗口。我想知道的是如何初始化第二个窗口。我尝试了onReset和onReveal方法,但它们似乎从未触发过,此外,在重置值时,使用destroy()将永久杀死我的窗口。我最终得到了下面的解决方案,但我觉得效率不是太高,有人能推荐我一个方法吗?
public void onSuccess(LoginResult result) {
if(result.getResponse().equalsIgnoreCase("OK")){
getView().getUsernameField().setValue("");
getView().getPasswordField().setValue("");
getView().getWindow().hide();
memberWindow.setUsername(username);
memberWindow.loadAppointments(new Date());
((Window) memberWindow.getWidget()).show();
}else{
SC.say("Error", "Login failed because: " + result);
}发布于 2011-12-29 20:08:02
试试下面这样的东西
@Override
public void onSuccess(LoginResult result) {
CurrentUser currentUser = new CurrentUser(getView().getUserName());
LoginAuthenticatedEvent.fire(eventBus, currentUser);
// notice the place manager call. The transitions between the pages are
// done in GWTP through PlaceManager.revealPlace(PlaceRequest) call.
PlaceRequest placeRequest = new PlaceRequest(NameTokens.mainPage);
getPlaceManager().revealPlace(placeRequest);
}查看Serendipity应用程序中的src\au\com\uptick\serendipity\client\presenter\SignInPagePresenter.java,这是一个使用SmartGWT + GWTP完成登录的示例:
http://code.google.com/p/crmdipity/downloads/detail?name=Serendipity-0.6.0.zip&can=2&q=
https://stackoverflow.com/questions/7911265
复制相似问题