我正在尝试从GWT演示者窗口小部件获取URL参数,但我收到以下错误消息:
The method prepareFromRequest(PlaceRequest) of type ViewDiagramPresenter must override or implement a supertype method
The method prepareFromRequest(PlaceRequest) is undefined for the type PresenterWidget<ViewDiagramPresenter.MyView>
有什么想法吗?谢谢你
public class ViewDiagramPresenter extends
PresenterWidget<ViewDiagramPresenter.MyView> {
[...]
@Override
public void prepareFromRequest(PlaceRequest placeRequest) {
super.prepareFromRequest(placeRequest);
String actionString = placeRequest.getParameter("action", "view");
}
[...]
}
答案 0 :(得分:1)
班级PresenterWidget
似乎没有名为prepareFromRequest()
的方法。也许你的意思是从gwtp扩展Presenter
类?
答案 1 :(得分:1)
将PlaceManager
注入PresenterWidget并处理onReset()
方法中的网址。
public class ViewDiagramPresenter extends
PresenterWidget<ViewDiagramPresenter.MyView> {
protected final PlaceManager placeManager;
@Inject
public ViewDiagramPresenter(final EventBus eventBus, final MyView view, final MyProxy proxy, final PlaceManager placeManager) {
super(eventBus, view, proxy);
this.placeManager = placeManager;
}
@Override
public void onReset() {
super.onReset();
PlaceRequest placeRequest = placeManager.getCurrentPlaceRequest();
String actionString = placeRequest.getParameter("action", "view");
}
}