私はgwt-platformを使用していて、GWTのエディタフレームワークを実装しようとしました。しかし、私は発表者の中からそれを働かせることはできません。私は成功せず、これを試してみました瞬間があり、私はプレゼンターに何とかEditorDriverを注入しなければならないと言うウェブの周りのいくつかの答えは、ですが、私はこれを行う方法がわからない...gwt-editorでGWTのエディタフレームワークを使用するには?
:
public class MyPresenter extends Presenter<MyPresenter.MyView, MyPresenter.MyProxy> implements MyUiHandlers {
public interface MyView extends View, HasUiHandlers<MyUiHandlers>, Editor<MyModel> {}
@ProxyStandard
@NameToken(NameTokens.myPage)
@NoGatekeeper
public interface MyProxy extends ProxyPlace<MyPresenter> {}
interface Driver extends SimpleBeanEditorDriver<MyModel, MyView> {}
private Driver editorDriver;
DispatchAsync dispatcher;
@Inject
public MyPresenter(EventBus eventBus, MyView view, MyProxy proxy, DispatchAsync dispatcher) {
super(eventBus, view, proxy);
getView().setUiHandlers(this);
this.dispatcher = dispatcher;
MyModel m = new MyModel();
m.setId(1L);
m.setUsername("username");
m.setPassword("password");
editorDriver = GWT.create(Driver.class);
editorDriver.initialize(this.getView());
editorDriver.edit(m);
}
...
}
私は明示的にViewImplementationを指定した場合、それは動作しますが、それはMVPが動作するはずな方法ではありません。
interface Driver extends SimpleBeanEditorDriver<MyModel, MyViewImpl> {}
...
editorDriver.initialize((MyViewImpl) this.getView());
誰かが私に右のそれを行う方法の例を与えることができれば、私はいいだろう。
おかげ
にドライバの参照を渡すために使用することができますありがとうございました:)たぶん、あなたは正しいとビューがモデルを知っている場合、それは悪くはありません、 "私はViewInterfaceで多くのセッターとゲッターを設定しなければなりません。これは、Viewがそのモデルも知っていることを意味します。 –
これはすばらしい解決策です。ありがとうございました! – confile
ありがとうございます。編集者とGWTPとの2日間の戦いの後、ついにそれを効かせます。あなたがこれについていくつかの改善を行ったなら、私に知らせてください。 – masterdany88