1

我试图将 placerequest 中的参数传递给将是弹出窗口的演示者,但是,我在弹出窗口演示者中收到空参数..我忘了什么吗?

添加项目演示者

public class AddProjetoPresenter extends Presenter<AddProjetoPresenter.AddProjetoView, AddProjetoPresenter.AddProjetoProxy>
    {
    @ProxyCodeSplit
    @NameToken(NameTokens.addproj)
    public interface AddProjetoProxy extends ProxyPlace<AddProjetoPresenter>
    {
    }

    public interface AddProjetoView extends View
    {
        HasValue<String> getNome();

        HasValue<Date> getDtInicio();

        HasValue<Date> getDtFim();

        HasClickHandlers getAddRequisitos();

        HasClickHandlers getAddStakeholders();

        HasClickHandlers getBtCancelar();

        HasClickHandlers getBtSalvar();
    }

    private final DispatchAsync dispatch;
    private final PlaceManager placeManager;
    private Projeto projeto;

    @Inject
    public AddProjetoPresenter(final EventBus eventBus, final AddProjetoView view, final AddProjetoProxy proxy, final DispatchAsync dispatch,
            final PlaceManager placeManager)
    {
        super(eventBus, view, proxy);
        this.dispatch = dispatch;
        this.placeManager = placeManager;
    }

    @Override
    protected void revealInParent()
    {
        RevealContentEvent.fire(this, MainPresenter.TYPE_SetMainContent, this);
    }

    @Override
    protected void onBind()
    {
        super.onBind();

        getView().getBtSalvar().addClickHandler(new ClickHandler()
        {
            @Override
            public void onClick(ClickEvent event)
            {

            }
        });

        getView().getAddRequisitos().addClickHandler(new ClickHandler()
        {
            @Override
            public void onClick(ClickEvent event)
            {
                PlaceRequest pr = new PlaceRequest(NameTokens.addreq);
                pr.with("oi", "oiiiii"); // HERE
                placeManager.revealPlace(pr, false);
            }
        });
    }

}

添加RequisitoPresenter

public class AddRequisitoPresenter extends Presenter<AddRequisitoPresenter.AddRequisitoView, AddRequisitoPresenter.AddRequisitoProxy>
{

    @ProxyCodeSplit
    @NameToken(NameTokens.addreq)
    public interface AddRequisitoProxy extends ProxyPlace<AddRequisitoPresenter>
    {

    }

    public interface AddRequisitoView extends PopupView
    {
        DialogBox getDialog();
    }

    private final DispatchAsync dispatcher;
    private Projeto projeto;

    @Inject
    public AddRequisitoPresenter(final EventBus eventBus, final AddRequisitoView view, final AddRequisitoProxy proxy, final DispatchAsync dispatcher)
    {
        super(eventBus, view, proxy);
        this.dispatcher = dispatcher;
    }

    @Override
    public void prepareFromRequest(PlaceRequest request)
    {
        super.prepareFromRequest(request);
        getView().getDialog().setText(request.getParameterNames().size() + ""); //SIZE IS ZERO!!
    }

    @Override
    protected void onBind()
    {
        super.onBind();
    }

    @Override
    protected void revealInParent()
    {
        RevealRootPopupContentEvent.fire(this, this);
    }
}

我认为我做错了什么......

提前致谢。

4

1 回答 1

1

根据我在wiki中的理解,弹出窗口不能是一个地方,它需要一个父演示者。

我在这里看到两个明显的问题:

  • 您的第二个演示者(弹出窗口)应该实现 PresenterWidget,而不是 Presenter
  • 您不能通过调用 placeManager.revealPlace() 来显示弹出窗口,因为弹出窗口不是地点。相反,您必须应用wiki中解释的两种方法之一(addToPopupSlot() 或 RevealRootPopupContentEvent.fire(),均从父级调用)。
于 2011-09-22T07:32:07.410 回答