1

私は GWT-Platform で何かをしようとしましたが、このページの例に従ってください: http://code.google.com/p/gwt-platform/wiki/GettingStarted?tm=6シンプルでは機能しません。

次のエラーが発生しました。

java.lang.AssertionError: 内部エラー。updateHistory に渡された PlaceRequest がプレース階層の末尾と一致しません。com.gwtplatform.mvp.client.proxy.PlaceManagerImpl.updateHistory(PlaceManagerImpl.java:489) で com.gwtplatform.mvp.client.proxy.ProxyPlaceAbstract$3$1.execute(ProxyPlaceAbstract.java:208) で com.google.gwt .core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50) com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:228) com.google.gwt .core.client.impl.SchedulerImpl.flushPostEventPumpCommands(SchedulerImpl.java:388) com.google.gwt.core.client.impl.SchedulerImpl$Flusher.execute(SchedulerImpl.java:78) com.google.gwt.core .client.impl.SchedulerImpl.execute(SchedulerImpl.java:138) at sun.reflect.

PlaceRequest を作成しようとすると。

PlaceManager がインジェクトされているために発生していると思いますが、どういうわけか、シングルトンほどではありませんが、wiki (http://code.google.com/p/gwt-platform/wiki/GettingStarted?tm=6# Binding_everything_together):

DefaultModule をインストールすると、次のバインディングをすべて実行する必要がなくなります。bind(TokenFormatter.class).to(ParameterTokenFormatter.class).in(Singleton.class); bind(RootPresenter.class).asEagerSingleton(); bind(PlaceManager.class).to(MyPlaceManager.class).in(Singleton.class); bind(GoogleAnalytics.class).to(GoogleAnalyticsImpl.class).in(Singleton.class);

プレースマネージャーはすでにシングルトンでなければなりません...しかし、それは単に機能しません。

誰かがこの問題を抱えていますか?

4

3 に答える 3

3

gwtp 0.6 でこの問題が発生したばかりだったので、問題の解決策を見つけました。

問題は、PlaceManager の実装を ClientModule クラスにバインドしたことであることが判明しました。

  protected void configure() {
    // Singletons
    install(new DefaultModule(ClientPlaceManager.class));
    ...

次に、プレゼンターコンストラクターで同じ実装を自動的にバインドします

  private ClientPlaceManager placeManager ; //wrong - should be the interface

  @Inject
  public FrameworkLayoutPresenter(final EventBus eventBus, final MyView view, final MyProxy proxy, 
      final ClientPlaceManager placeManager) //wrong - should be the interface
  {
    super(eventBus, view, proxy);
    this.placeManager = placeManager ;
    ...

しかし、インターフェイス PlaceManager をバインドする必要がありました

  private PlaceManager placeManager ; 

  @Inject
  public FrameworkLayoutPresenter(final EventBus eventBus, final MyView view, final MyProxy proxy, 
      final PlaceManager placeManager) 
  {
    super(eventBus, view, proxy);
    this.placeManager = placeManager ;
    ...
于 2012-02-26T07:38:19.733 に答える
1

GTWP 0.6を使用している場合は、次のようにDefaultModuleを使用できます。

public class ClientModule extends AbstractPresenterModule {
    @Override
    protected void configure() {
         install(new DefaultModule(MyPlaceManager.class));
}

DefaultModuleは、EventBus、TokenFormatter、RootPresenter、PlaceManager、およびGoogleAnalyticsのバインドを処理します。

于 2011-09-20T08:23:30.780 に答える