예제 #1
0
  /*
   * (non-Javadoc)
   *
   * @see com.planetsystems.procnet.gwtui.client.events.CurrencyUiHandlers#
   * onSaveCurrencyButtonClicked()
   */
  public void onSaveCurrencyButtonClicked(Currency currency) {

    dispatcher.execute(
        new CurrencyAction(NameTokens.saveOperation, NameTokens.currencies, currency),
        new AsyncCallback<CurrencyResult>() {

          public void onFailure(Throwable caught) {
            getView().setServerResponse("An error Occured: " + caught.getMessage());
          }

          public void onSuccess(CurrencyResult result) {

            if (result.isOperationStatus() == true) {

              getView().setServerResponse(result.getServerResponse());
              onLoadCurrencyButtonClicked();
              getView().ClearCurrency();

            } else {

              getView().setServerResponse(result.getServerResponse());
            }
          }
        });
  }
예제 #2
0
  @Override
  public void prepareFromRequest(PlaceRequest request) {
    super.prepareFromRequest(request);
    PlaceRequest currentPlace = placeManager.getCurrentPlaceRequest();
    String phenotype_id = currentPlace.getParameter("id", "");
    if (phenotype_id.equals("")) getProxy().manualReveal(PhenotypePresenter.this);
    else {
      dispatch.execute(
          new GetPhenotypeDataAction(phenotype_id, phenotypeReader),
          new CustomCallback<GetPhenotypeDataActionResult>(getEventBus()) {

            @Override
            public void onSuccess(GetPhenotypeDataActionResult result) {
              PhenotypePresenter.this.phenotype = result.getPhenotype();
              PhenotypePresenter.this.mRNAHistogramDataTable = result.getmRNAHistogramDataTable();
              PhenotypePresenter.this.bsHistogramDataTable = result.getBsHistogramDataTable();
              getProxy().manualReveal(PhenotypePresenter.this);
            }

            @Override
            public void onFailure(Throwable caught) {
              getProxy().manualReveal(PhenotypePresenter.this);
              super.onFailure(caught);
              // getProxy().manualRevealFailed();
            }
          });
    }
  }
  private void setdata(
      String model, Date dateFrom, Date dateTo, final String segVal, final ModalWindow mw) {

    if (!UNIFYING.equals(userId)) {

      GetUserStatisticDataAction statisticDataAction =
          new GetUserStatisticDataAction(userId, model, dateFrom, dateTo, segVal);
      dispatcher.execute(
          statisticDataAction,
          new DispatchCallback<GetUserStatisticDataResult>() {

            @Override
            public void callback(GetUserStatisticDataResult result) {
              if (result.getData() != null) {
                setData(result.getData(), userName);
              } else {
                SC.warn("There is no data!!!");
              }
              mw.hide();
              afterDraw();
            }

            /** {@inheritDoc} */
            @Override
            public void callbackError(Throwable t) {
              super.callbackError(t);
              mw.hide();
              afterDraw();
            }
          });
    } else {
      setData(null, null);
      mw.hide();
    }
  }
  public void populateBorderTypeListBox() {

    getView()
        .getBorderTypeListBox()
        .clear(); // need this for when the method is called via an event

    dispatch.execute(
        new GetMtfccTypesAction(),
        new AsyncCallback<GetMtfccTypesResult>() {
          @Override
          public void onFailure(Throwable throwable) {
            throwable.printStackTrace();
          }

          @Override
          public void onSuccess(final GetMtfccTypesResult result) {
            Map<String, String> resultMap = result.getResult();

            // we can get away with this as the implementation is actually a LinkedHashMap. This is
            // much cleaner than the previous code.
            for (String key : resultMap.keySet()) {
              getView().getBorderTypeListBox().addItem(key, resultMap.get(key));
            }

            getView().getPrimaryListBox().clear();
            getView().getSecondaryListBox().clear();

            getView().getPrimaryListBox().addItem("-- Select A Border Type --", "");
            getView().getSecondaryListBox().addItem("-- Select A Border Type --", "");
          }
        });
  }
예제 #5
0
  /*
   * (non-Javadoc)
   *
   * @see com.planetsystems.procnet.gwtui.client.events.CurrencyUiHandlers#
   * onDeleteExchangeButtonCliked()
   */
  public void onDeleteExchangeButtonCliked(CurrencyExchangeRate rate) {

    dispatcher.execute(
        new CurrencyAction(NameTokens.deleteOperation, NameTokens.currencyExchangeRates, rate),
        new AsyncCallback<CurrencyResult>() {

          public void onFailure(Throwable caught) {
            GWT.log("Save Currency onFailure()...", null);
            getView().setServerResponse("An error Occured: " + caught.getMessage());
          }

          public void onSuccess(CurrencyResult result) {

            if (result.isOperationStatus() == true) {

              getView().setServerResponse(result.getServerResponse());
              onLoadCurrencyExchangeButtonClicked();
              getView().ClearCurrency();

            } else {

              getView().setServerResponse(result.getServerResponse());
            }
          }
        });
  }
예제 #6
0
  /*
   * (non-Javadoc)
   *
   * @see com.planetsystems.procnet.gwtui.client.events.CurrencyUiHandlers#
   * onSaveExchangeButtonClicked()
   */
  public void onSaveExchangeButtonClicked(CurrencyExchangeRate rate) {

    dispatcher.execute(
        new CurrencyAction(NameTokens.saveOperation, NameTokens.currencyExchangeRates, rate),
        new AsyncCallback<CurrencyResult>() {

          public void onFailure(Throwable caught) {
            getView().setServerResponse("An error Occured: " + caught.getMessage());
          }

          public void onSuccess(CurrencyResult result) {

            getView().setServerResponse(result.getServerResponse());
            onLoadCurrencyExchangeButtonClicked();
            // getView().ClearCurrency();

            // } else {

            /*
             * Log.info("onSuccess:false ");
             * getView().setServerResponse(
             * result.getServerResponse());
             */
            // }

          }
        });
  }
  private void doChangeSecondaryListBox() {
    // as usual, determine the mtfcc from the BTLB
    String mtfcc = getBTLBValue();

    // if the mtfcc is a county based feature but is not a county...
    if (!mtfcc.equals(GeographyUtils.MTFCC.COUNTY) && GeographyUtils.isCountyBasedMtfcc(mtfcc)) {

      // get the state and county FIPS codes
      String geoId = getSLBValue();
      String stateFP = geoId.substring(0, 2);
      String countyFP = geoId.substring(2);

      dispatch.execute(
          new GetLocationsByStateAndCountyAndMtfccAction(mtfcc, stateFP, countyFP),
          new AsyncCallback<GetLocationsByStateAndCountyAndMtfccResult>() {
            @Override
            public void onFailure(Throwable throwable) {
              throwable.printStackTrace();
            }

            @Override
            public void onSuccess(GetLocationsByStateAndCountyAndMtfccResult result) {

              getView().getTertiaryListBox().clear();
              getView().getTertiaryListBox().addItem("-- Select Feature --");
              Map<String, String> resultMap = result.getResult();
              for (String fp : resultMap.keySet()) {
                getView().getTertiaryListBox().addItem(resultMap.get(fp), fp);
              }
            }
          });

      getView().getTertiaryListBox().setEnabled(true);
    }
  }
  protected void submitRequest(ExecuteWorkflow workflow) {
    dispatcher.execute(
        workflow,
        new TaskServiceCallback<ExecuteWorkflowResult>() {

          @Override
          public void processResult(ExecuteWorkflowResult result) {}
        });
  }
예제 #9
0
 @Override
 public void deletePhenotype(Phenotype phenotype) {
   dispatch.execute(
       new DeletePhenotypeAction(phenotype.getName(), backendResultReader),
       new GWASCallback<BaseStatusResult>(getEventBus()) {
         @Override
         public void onSuccess(BaseStatusResult result) {
           UpdateDataEvent.fire(PhenotypeListPresenter.this);
         }
       });
 }
예제 #10
0
  private void doPesquisar() {
    dispatcher.execute(
        new BuscarContatoAction(getView().campo().getValue()),
        new AsyncCallback<BuscarContatoResult>() {
          @Override
          public void onFailure(Throwable caught) {
            ShowMsgEvent.fire(
                ListaContatosPresenter.this,
                "Erro: " + caught.getLocalizedMessage(),
                AlertType.ERROR);
          }

          @Override
          public void onSuccess(BuscarContatoResult result) {
            getView().setContatos(result.getContatos());
          }
        });
  }
예제 #11
0
  public static void authentification(
      final DispatchAsync dispatcher,
      LoginPagePresenter.MyView view,
      final PlaceManager placeManager) {
    view.getSendButton().setEnabled(false);
    dispatcher.execute(
        new AuthentificationAction(
            view.getEmailAuthTextBox().getText(), view.getPasswordAuthTextBox().getText()),
        new AsyncCallback<AuthentificationResult>() {

          public void onFailure(Throwable caught) {
            Window.alert("Login failed: " + caught.getMessage());
          }

          public void onSuccess(AuthentificationResult result) {
            ContextUI.get().setUserCourant(result.getUserCriteria());
            final PlaceRequest myRequest = new PlaceRequest(DockLayoutPagePresenter.nameToken);
            placeManager.revealPlace(myRequest);
          }
        });
  }
예제 #12
0
  /*
   * (non-Javadoc)
   *
   * @see com.planetsystems.procnet.gwtui.client.events.CurrencyUiHandlers#
   * onLoadCurrencyStates()
   */
  public void onLoadCurrencyStates() {

    dispatcher.execute(
        new CurrencyAction(NameTokens.retrieveCurrencyStates, NameTokens.currencies),
        new AsyncCallback<CurrencyResult>() {
          public void onFailure(Throwable caught) {
            caught.printStackTrace();
            getView().setServerResponse("An error occured: " + caught.getMessage());
          }

          public void onSuccess(CurrencyResult result) {

            if (result.isOperationStatus() == true) {

              getView().loadCurrencyStates(result.getCurrencyStates());

            } else {
              getView().setServerResponse(result.getServerResponse());
            }
          }
        });
  }
  /**
   * Populate the PrimaryListBox() - the PLB is only supposed to be populated with states that have
   * the border type selected in the BTLB loaded.
   */
  public void populatePrimaryListBox() {

    // get the mtfcc code from the BTLB
    int mtfccValue = getView().getBorderTypeListBox().getSelectedIndex();
    String mtfcc = getView().getBorderTypeListBox().getValue(mtfccValue);

    // dispatch to get the states that have borders from the given mtfcc code loaded
    dispatch.execute(
        new GetStatesByMtfccAction(mtfcc),
        new AsyncCallback<GetStatesByMtfccResult>() {
          @Override
          public void onFailure(Throwable throwable) {
            throwable.printStackTrace();
          }

          @Override
          public void onSuccess(GetStatesByMtfccResult result) {
            List<Map<String, String>> resultMapList = result.getResult();

            if (resultMapList.size() > 0) {

              getView().getPrimaryListBox().clear();
              getView().getPrimaryListBox().addItem("-- Select A State --", "");

              for (Map<String, String> resultMap : resultMapList) {
                getView()
                    .getPrimaryListBox()
                    .addItem(resultMap.get("name"), resultMap.get("stateFP"));
              }

              getView().getSecondaryListBox().clear();
              getView().getSecondaryListBox().addItem("-- Select A State --", "");
            } else {
              Window.alert("No states available for selected Border type.");
            }
          }
        });
  }
예제 #14
0
  public void onLoadCurrencyExchangeButtonClicked() {

    dispatcher.execute(
        new CurrencyAction(NameTokens.retrieveOperation, NameTokens.currencyExchangeRates),
        new AsyncCallback<CurrencyResult>() {

          public void onFailure(Throwable caught) {
            getView().setServerResponse("An error Occured: " + caught.getMessage());
          }

          public void onSuccess(CurrencyResult result) {

            if (result.isOperationStatus() == true) {

              getView().loadCurrencyRates(result.getRates());

            } else {

              getView().setServerResponse(result.getServerResponse());
            }
          }
        });
  }
예제 #15
0
  private static void onRefresh(DispatchAsync dispatcher, final LangConstants lang) {
    if (ready) {
      synchronized (LOCK) {
        if (ready) { // double-lock idiom
          ready = false;
          final ModalWindow mw = new ModalWindow(inputQueueTree);
          mw.setLoadingIcon("loadingAnimation.gif");
          mw.show(true);
          dispatcher.execute(
              new ScanInputQueueAction(null, true),
              new DispatchCallback<ScanInputQueueResult>() {

                @Override
                public void callback(ScanInputQueueResult result) {
                  ServerActionResult serverActionResult = result.getServerActionResult();
                  if (serverActionResult.getServerActionResult() == SERVER_ACTION_RESULT.OK) {
                    mw.hide();
                    refreshTree();
                    ready = true;
                  } else if (serverActionResult.getServerActionResult()
                      == SERVER_ACTION_RESULT.WRONG_FILE_NAME) {
                    mw.hide();
                    SC.warn(lang.wrongDirName() + serverActionResult.getMessage());
                  }
                }

                @Override
                public void callbackError(final Throwable t) {
                  mw.hide();
                  super.callbackError(t);
                  ready = true;
                }
              });
        }
      }
    }
  }
  private void populateFeaturesListBox() {

    dispatch.execute(
        new GetFeatureClassesAction(),
        new AsyncCallback<GetFeatureClassesResult>() {
          @Override
          public void onFailure(Throwable throwable) {
            throwable.printStackTrace();
          }

          @Override
          public void onSuccess(GetFeatureClassesResult getFeatureClassesResult) {

            getView()
                .getFeaturesListBox()
                .clear(); // just in case, we don't want to keep appending to the existing
            getView().getFeaturesListBox().addItem("-- Select Feature --", "-1");
            List<String> result = getFeatureClassesResult.getResult();
            for (String fc : result) {
              getView().getFeaturesListBox().addItem(fc);
            }
          }
        });
  }
예제 #17
0
  /**
   * Instantiates a new side nav input tree.
   *
   * @param dispatcher the dispatcher
   * @param lang
   */
  private InputQueueTree(
      final DispatchAsync dispatcher, final LangConstants lang, final EventBus eventBus) {
    this.lang = lang;
    setWidth100();
    setHeight100();
    setCustomIconProperty("icon");
    setAnimateFolderTime(100);
    setAnimateFolders(true);
    setAnimateFolderSpeed(1000);
    setNodeIcon("silk/application_view_list.png");
    setFolderIcon("silk/folder.png");
    setShowOpenIcons(true);
    setShowDropIcons(false);
    setShowSortArrow(SortArrow.CORNER);
    setShowConnectors(true);
    setShowAllRecords(true);
    setLoadDataOnDemand(true);
    setCanSort(true);
    setAutoFetchData(true);
    setShowRoot(false);
    setSelectionType(SelectionStyle.SINGLE);
    setShowRollOverCanvas(true);

    MenuItem showItem = new MenuItem(lang.show(), "icons/16/structure.png");
    final Menu showMenu = new Menu();
    showMenu.setShowShadow(true);
    showMenu.setShadowDepth(10);
    showMenu.setItems(showItem);

    createItem = new MenuItem(lang.create(), "icons/16/structure_into.png");

    final Menu editMenu = new Menu();
    editMenu.setShowShadow(true);
    editMenu.setShadowDepth(10);
    setContextMenu(editMenu);

    dispatcher.execute(
        new HasUserRightsAction(new EDITOR_RIGHTS[] {EDITOR_RIGHTS.LONG_RUNNING_PROCESS}),
        new DispatchCallback<HasUserRightsResult>() {

          @Override
          public void callback(HasUserRightsResult result) {
            canLongProcess = result.getOk()[0];
          }
        });

    addCellContextClickHandler(
        new CellContextClickHandler() {

          @Override
          public void onCellContextClick(CellContextClickEvent event) {

            ListGridRecord record = event.getRecord();
            final String path = record.getAttribute(Constants.ATTR_ID);
            if (path != null && path.length() > 1 && path.substring(1).contains("/")) {
              // String model = path.substring(1, path.substring(1).indexOf("/") + 1);
              String id = path.substring(path.substring(1).indexOf("/") + 2);
              if (id.contains("/")) {
                id = id.substring(0, id.indexOf("/"));
              }

              MenuItem quartz = new MenuItem(lang.addToScheduler(), "icons/16/clock.png");
              quartz.addClickHandler(
                  new ClickHandler() {

                    @Override
                    public void onClick(MenuItemClickEvent event) {

                      String msg = event.getMenu().getEmptyMessage(); // duplicate code
                      String model = msg.substring(0, msg.indexOf("/"));
                      String path = msg.substring(msg.indexOf("/") + 1);

                      QuartzConvertImagesAction action = new QuartzConvertImagesAction(model, path);

                      DispatchCallback<QuartzConvertImagesResult> quartzConvertCallback =
                          new DispatchCallback<QuartzConvertImagesResult>() {

                            @Override
                            public void callback(QuartzConvertImagesResult result) {
                              if (result.getNumberOfImages() != null) {
                                SC.say(
                                    result.getNumberOfImages().toString()
                                        + " images will be converted");
                              } else {
                                SC.say("No images found");
                              }
                            }
                          };

                      dispatcher.execute(action, quartzConvertCallback);
                    }
                  });

              if (record.getAttributeAsBoolean(Constants.ATTR_INGEST_INFO)) {
                MenuItem ingestInfo = new MenuItem(lang.ingestInfo(), "icons/16/export1.png");
                ingestInfo.addClickHandler(
                    new ClickHandler() {

                      @Override
                      public void onClick(MenuItemClickEvent event) {
                        getIngestInfo(path, dispatcher, eventBus);
                      }
                    });
                if (canLongProcess) {
                  editMenu.setItems(createItem, ingestInfo, quartz);
                } else {
                  editMenu.setItems(createItem, ingestInfo);
                }
              } else {
                if (canLongProcess) {
                  editMenu.setItems(createItem, quartz);
                } else {
                  editMenu.setItems(createItem);
                }
              }

              editMenu.setEmptyMessage(path.substring(1, path.length()));
              editMenu.showContextMenu();
            } else {
              showMenu.showContextMenu();
            }
          }
        });
    addShowContextMenuHandler(
        new ShowContextMenuHandler() {

          @Override
          public void onShowContextMenu(ShowContextMenuEvent event) {
            event.cancel();
          }
        });

    eventBus.addHandler(
        RefreshTreeEvent.getType(),
        new RefreshTreeEvent.RefreshTreeHandler() {

          @Override
          public void onRefreshTree(RefreshTreeEvent event) {
            if (event.getTree() == NAME_OF_TREE.INPUT_QUEUE) refreshTree();
          }
        });

    TreeGridField field1 = new TreeGridField();
    field1.setCanFilter(true);
    field1.setName(Constants.ATTR_BARCODE);
    field1.setTitle("ID");
    field1.setCellFormatter(
        new CellFormatter() {

          @Override
          public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
            boolean ingestInfo = record.getAttributeAsBoolean(Constants.ATTR_INGEST_INFO);
            if (ingestInfo) {
              return record.getAttribute(Constants.ATTR_BARCODE) + HTML_TICK_CODE;

            } else {
              return record.getAttribute(Constants.ATTR_BARCODE);
            }
          }
        });
    ListGridField nameField = new ListGridField();
    nameField.setCanFilter(true);
    nameField.setName(Constants.ATTR_NAME);
    nameField.setTitle(lang.name());

    setFields(field1, nameField);
    setDataSource(new InputTreeGwtRPCDS(dispatcher, lang));
  }
  private void doChangePrimaryListBox() {

    getView().getSecondaryListBox().clear();
    getView().getTertiaryListBox().clear();

    // as usual, determine the mtfcc from the BTLB
    String mtfcc = getBTLBValue();

    // make sure that if it's just a state, we don't do anything
    if (mtfcc.equals(GeographyUtils.MTFCC.STATE)) {
      return; // exit onChange() so that we don't process via any call to
      // GeographyUtils.isStateBasedMtfcc()
    }

    if (mtfcc.equals(GeographyUtils.MTFCC.COUNTY)) {

      // okay, I'm violating DRY. Hate me if you want.

      String stateFP = getPLBValue();

      dispatch.execute(
          new GetLocationsByStateAndMtfccAction(stateFP, GeographyUtils.MTFCC.COUNTY),
          new AsyncCallback<GetLocationsByStateAndMtfccResult>() {
            @Override
            public void onFailure(Throwable throwable) {
              getView().getSecondaryListBox().setEnabled(false);
              throwable.printStackTrace();
            }

            @Override
            public void onSuccess(GetLocationsByStateAndMtfccResult result) {

              getView().getSecondaryListBox().clear();
              getView().getSecondaryListBox().addItem("-- Select County --");
              Map<String, String> resultMap = result.getResult();
              resultMap.remove(null);
              for (String key : resultMap.keySet()) {
                getView().getSecondaryListBox().addItem(resultMap.get(key), key);
              }
              getView().getSecondaryListBox().setEnabled(true);
            }
          });

      return;
    }

    // if it's a state-based mtfcc, populate the TLB with the location names
    if (GeographyUtils.isStateBasedMtfcc(mtfcc)) {

      String stateFP = getPLBValue();

      dispatch.execute(
          new GetLocationsByStateAndMtfccAction(stateFP, mtfcc),
          new AsyncCallback<GetLocationsByStateAndMtfccResult>() {
            @Override
            public void onFailure(Throwable caught) {
              caught.printStackTrace();
            }

            @Override
            public void onSuccess(GetLocationsByStateAndMtfccResult result) {
              getView().getTertiaryListBox().setEnabled(true);
              Map<String, String> resultMap = result.getResult();
              resultMap.remove(null);
              resultMap.remove(getPLBValue());
              for (String key : resultMap.keySet()) {
                getView().getTertiaryListBox().addItem(resultMap.get(key), key);
              }
            }
          });

      return;
    }

    if (GeographyUtils.isCountyBasedMtfcc(mtfcc)) {

      String stateFP = getPLBValue();

      dispatch.execute(
          new GetLocationsByStateAndMtfccAction(stateFP, GeographyUtils.MTFCC.COUNTY),
          new AsyncCallback<GetLocationsByStateAndMtfccResult>() {
            @Override
            public void onFailure(Throwable throwable) {
              getView().getSecondaryListBox().setEnabled(false);
              throwable.printStackTrace();
            }

            @Override
            public void onSuccess(GetLocationsByStateAndMtfccResult result) {

              getView().getSecondaryListBox().clear();
              getView().getSecondaryListBox().addItem("-- Select County --");
              Map<String, String> resultMap = result.getResult();
              resultMap.remove(null);
              for (String key : resultMap.keySet()) {
                getView().getSecondaryListBox().addItem(resultMap.get(key), key);
              }
              getView().getSecondaryListBox().setEnabled(true);
            }
          });

      return; // exit function to ensure that we don't process via isCountyBasedMtfcc()
    }
  }