Exemplo n.º 1
0
  public void loadModel(KBWorkspaceObjectData modelData, boolean showAllRxns) {
    if (modelData == null || modelData.getId() == null || modelData.getWorkspace() == null) return;

    eventBus.fireEvent(new LoadingEvent(false));
    rpc.getKBaseMetabolicModel(
        modelData.getId(),
        modelData.getWorkspace(),
        new AsyncCallback<KBMetabolicModel>() {

          @Override
          public void onFailure(Throwable caught) {
            Window.alert("Remote procedure call failure: getKBaseMetabolicModel");
            setState(State.NO_MODELS_LOADED);
            eventBus.fireEvent(new LoadingEvent(true));
          }

          @Override
          public void onSuccess(KBMetabolicModel model) {
            // fire it off to the rest of the app.
            eventBus.fireEvent(
                new MetabolicModelLoadedEvent(model, view.getShowAllCheckBox().getValue()));
            if (model == null || model.getId().length() == 0) {
              Window.alert(
                  "Sorry, unable to display that model. Please try again.\nIf this problem persists, please contact the site administrator.");
            } else setState(State.MODEL_SELECTED);
            eventBus.fireEvent(new LoadingEvent(true));
          }
        });
  }