使用GWT Presenter小部件中的prepareFromRequest(PlaceRequest)

时间:2012-10-22 20:19:05

标签: java gwt url-parameters gwtp

我正在尝试从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");
    }
[...]
}

2 个答案:

答案 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");
    }
}