Exemplo n.º 1
0
  @Override
  public void start(final AcceptsOneWidget panel, EventBus eventBus) {
    final String msg = "Failed to load book selection data. [" + category.toString() + "]";

    panel.setWidget(view);
    LoadingPanel.INSTANCE.show();
    view.setPresenter(this);

    eventBus.fireEvent(new SidebarItemSelectedEvent(getLabel(category)));

    view.setHeaderText(getHeader(category));
    service.loadBookSelectionData(
        WebsiteConfig.INSTANCE.collection(),
        category,
        LocaleInfo.getCurrentLocale().getLocaleName(),
        new AsyncCallback<BookSelectList>() {
          @Override
          public void onFailure(Throwable caught) {
            logger.log(Level.SEVERE, msg, caught);
            view.addErrorMessage(msg);
            if (caught instanceof RosaConfigurationException) {
              view.addErrorMessage(caught.getMessage());
            }
            LoadingPanel.INSTANCE.hide();
          }

          @Override
          public void onSuccess(BookSelectList result) {
            LoadingPanel.INSTANCE.hide();
            if (result == null) {
              logger.severe(msg);
              view.addErrorMessage(msg);
              return;
            }
            result.setCategory(category);
            view.setData(result);
          }
        });

    Scheduler.get()
        .scheduleDeferred(
            new ScheduledCommand() {
              @Override
              public void execute() {
                view.onResize();
              }
            });
  }
Exemplo n.º 2
0
 @Override
 public void onStop() {
   LoadingPanel.INSTANCE.hide();
   view.clearErrors();
 }