Exemplo n.º 1
0
  /**
   * Prepares the presenter with the information contained in the current request, then reveals it.
   * Will refuse to reveal the display and do nothing if {@link #canReveal()} returns <code>false
   * </code>.
   *
   * @param request The request to handle. Can pass <code>null</code> if no request is used, in
   *     which case the presenter will be directly revealed.
   * @param updateBrowserUrl {@code true} If the browser URL should be updated, {@code false}
   *     otherwise.
   */
  private void handleRequest(final PlaceRequest request, final boolean updateBrowserUrl) {
    proxy.getPresenter(
        new NotifyingAsyncCallback<P>(eventBus) {

          @Override
          public void success(final P presenter) {
            // Everything should be bound before we prepare the presenter from the
            // request,
            // in case it wants to fire some events. That's why we will do this in a
            // deferred command.
            addDeferredCommand(
                new Command() {
                  @Override
                  public void execute() {
                    PlaceRequest originalRequest = placeManager.getCurrentPlaceRequest();
                    presenter.prepareFromRequest(request);
                    if (originalRequest == placeManager.getCurrentPlaceRequest()) {
                      // User did not manually update place request in prepareFromRequest, update it
                      // here.
                      placeManager.updateHistory(request, updateBrowserUrl);
                    }
                    NavigationEvent.fire(placeManager, request);
                    if (!presenter.useManualReveal()) {
                      // Automatic reveal
                      manualReveal(presenter);
                    }
                  }
                });
          }
        });
  }
Exemplo n.º 2
0
 @Override
 public void getRawPresenter(NotifyingAsyncCallback<Presenter<?, ?>> callback) {
   proxy.getRawPresenter(callback);
 }