Exemple #1
0
  public void loadGridData(PagingLoadConfig config) {
    AsyncCallback<DataContainer> callback =
        new AsyncCallback<DataContainer>() {
          public void onFailure(Throwable caught) {
            new ServerExceptionDialog("Failed to get response from server", caught.getMessage())
                .show();
          }

          public void onSuccess(DataContainer mainDataParent) {
            //                getPagingToolBar().setEnabled(true);

            store.removeAll();
            store.add(mainDataParent.getChildren(), true);

            mainDataGrid.expandAll();

            selectPreviouslySelectedItem();
            resetScrollBarPos();

            topToolbar.getSearchCombo().clear();
            topToolbar.getSearchCombo().populateSearchCombo();

            getPagingToolBar().showRefreshIconRunning(false);
            UtilManager.unmaskCentralPanel();
          }
        };
    DataManagementServiceAsync service =
        (DataManagementServiceAsync) Registry.get(HarvesterUI.DATA_MANAGEMENT_SERVICE);
    service.getMainData(config, callback);
  }
  public void onHistoryChanged(String historyToken) {
    String params = "[?]+";
    String[] tokensFunc = historyToken.split(params);

    if (tokensFunc.length > 1) {
      // functions with parameters
      String function = tokensFunc[0];
      String paramDelim = "[=]+";
      String[] tokensPrms = tokensFunc[1].split(paramDelim);
      String firstParamID = tokensPrms[0];
      String firstParamValue = tokensPrms[1];

      // types of functions
      //            if(function.equals("EDIT_AGG")) {
      //                AggregatorUI aggregatorUI = UtilManager.getAggregatorUI(firstParamValue);
      //                if(aggregatorUI == null) {
      //                    HarvesterUI.UTIL_MANAGER.getErrorBox("Edit Aggregator", "No Aggregator
      // found.");
      //                    Dispatcher.forwardEvent(AppEvents.ReloadAllData);
      //                } else{
      //                    Dispatcher.forwardEvent(AppEvents.ReloadAllData);
      //                    Dispatcher.forwardEvent(AppEvents.ViewAggregatorForm, aggregatorUI);
      //                }
      //            }else if(function.equals("EDIT_DP")) {
      //                DataProviderUI dataProviderUI =
      // UtilManager.getDataProviderUI(firstParamValue);
      //                if(dataProviderUI == null) {
      //                    HarvesterUI.UTIL_MANAGER.getErrorBox("Edit Data Provider", "No Data
      // Provider found.");
      //                    Dispatcher.forwardEvent(AppEvents.ReloadAllData);
      //                } else{
      //                    Dispatcher.forwardEvent(AppEvents.ReloadAllData);
      //                    Dispatcher.forwardEvent(AppEvents.ViewDataProviderForm, dataProviderUI);
      //                }
      //            } else
      if (function.equals("VIEW_DS")) {
        AsyncCallback<DataSourceUI> callback =
            new AsyncCallback<DataSourceUI>() {
              public void onFailure(Throwable caught) {
                new ServerExceptionDialog("Failed to get response from server", caught.getMessage())
                    .show();
              }

              public void onSuccess(DataSourceUI dataSourceUI) {
                if (dataSourceUI == null) {
                  HarvesterUI.UTIL_MANAGER.getErrorBox(
                      HarvesterUI.CONSTANTS.viewDataSet(), CONSTANTS.noDataSetFound());
                  Dispatcher.forwardEvent(AppEvents.LoadMainData);
                } else Dispatcher.forwardEvent(AppEvents.ViewDataSetInfo, dataSourceUI);
              }
            };
        DataManagementServiceAsync service =
            (DataManagementServiceAsync) Registry.get(HarvesterUI.DATA_MANAGEMENT_SERVICE);
        service.getDataSetInfo(firstParamValue, callback);
      }

      // Special case for Europeana
      //            if(function.equals("CREATE_DATA_PROVIDER")) {
      //                AggregatorUI aggregatorUI = UtilManager.getAggregatorUI(firstParamValue);
      //                if(aggregatorUI == null) {
      //                    HarvesterUI.UTIL_MANAGER.getErrorBox("Edit Aggregator", "No Aggregator
      // found.");
      //                    Dispatcher.forwardEvent(AppEvents.ReloadAllData);
      //                } else{
      //                    Dispatcher.forwardEvent(AppEvents.ReloadAllData);
      //                    Dispatcher.forwardEvent(AppEvents.ViewDataProviderForm, aggregatorUI);
      //                }
      //            }
    } else {
      if (historyToken.equals("HOME")) Dispatcher.forwardEvent(AppEvents.LoadMainData);
      else if (historyToken.equals("STATISTICS")) Dispatcher.forwardEvent(AppEvents.ViewStatistics);
      else if (historyToken.equals("CREATE_DATA_PROVIDER")) {
        Dispatcher.forwardEvent(AppEvents.LoadMainData);
        Dispatcher.forwardEvent(AppEvents.ViewDataProviderForm);
      } else if (historyToken.equals("CREATE_AGGREGATOR")) {
        Dispatcher.forwardEvent(AppEvents.LoadMainData);
        Dispatcher.forwardEvent(AppEvents.ViewAggregatorForm);
      } else if (historyToken.equals("IMPORT_DATA_PROVIDER")) {
        Dispatcher.forwardEvent(AppEvents.LoadMainData);
        Dispatcher.forwardEvent(AppEvents.ViewDPImportForm);
      } else if (historyToken.equals("MDR_SCHEMAS"))
        Dispatcher.forwardEvent(AppEvents.ViewSchemasPanel);
      else if (historyToken.equals("MDR_MAPPINGS"))
        Dispatcher.forwardEvent(AppEvents.ViewMappingsPanel);
      else if (historyToken.equals("MDR_XMAPPER"))
        Dispatcher.forwardEvent(AppEvents.ViewXMApperPanel);
      else if (historyToken.equals("OAI_TESTS")) Dispatcher.forwardEvent(AppEvents.ViewOAITest);
      // harvest menu tasks
      else if (historyToken.equals("CALENDAR"))
        Dispatcher.forwardEvent(AppEvents.ViewScheduledTasksCalendar);
      else if (historyToken.equals("SCHEDULED_TASKS"))
        Dispatcher.forwardEvent(AppEvents.ViewScheduledTasksList);
      else if (historyToken.equals("RUNNING_TASKS"))
        Dispatcher.forwardEvent(AppEvents.ViewRunningTasksList);
      else if (historyToken.equals("ADMIN_CONFIG"))
        Dispatcher.forwardEvent(AppEvents.ViewAdminForm);
      else if (historyToken.equals("USER_MANAGEMENT"))
        Dispatcher.forwardEvent(AppEvents.ViewUserManagementForm);
      else if (historyToken.equals("REST_OPERATIONS"))
        Dispatcher.forwardEvent(AppEvents.ViewRestRecordOperations);
      else if (historyToken.equals("EDIT_ACCOUNT")) {
        Dispatcher.forwardEvent(AppEvents.LoadMainData);
        Dispatcher.forwardEvent(AppEvents.ViewAccountEditForm);
      } else if (historyToken.equals("EXTERNAL_SERVICES_MANAGER"))
        Dispatcher.forwardEvent(AppEvents.ViewServiceManager);
      else if (historyToken.equals("RSS_PANEL"))
        Dispatcher.forwardEvent(AppEvents.ViewRssFeedPanel);
      else if (historyToken.equals("TAGS")) Dispatcher.forwardEvent(AppEvents.ViewTagsManager);

      if (!historyToken.equals("HOME")) UtilManager.unmaskCentralPanel();
    }
  }