@Override
  protected void onSearchEvent(@Observes SearchEvent searchEvent) {
    textSearchStr = searchEvent.getFilter();
    if (textSearchStr != null && textSearchStr.trim().length() > 0) {
      Map<String, Object> params = new HashMap<String, Object>();
      params.put("textSearch", textSearchStr);
      dataSetQueryHelper.getCurrentTableSettings().getKey();

      view.applyFilterOnPresenter(dataSetQueryHelper.getCurrentTableSettings().getKey());
    }
  }
  public void bulkAbort(List<ProcessInstanceVariableSummary> processInstances) {
    if (processInstances != null) {
      if (Window.confirm("Are you sure that you want to abort the selected process instances?")) {
        List<Long> ids = new ArrayList<Long>();
        for (ProcessInstanceVariableSummary selected : processInstances) {

          ids.add(selected.getProcessInstanceId());

          view.displayNotification(
              constants.Aborting_Process_Instance() + "(id=" + selected.getId() + ")");
        }
        abortProcessInstance(ids);
      }
    }
  }
  public void bulkSignal(List<ProcessInstanceVariableSummary> processInstances) {
    StringBuilder processIdsParam = new StringBuilder();
    if (processInstances != null) {

      for (ProcessInstanceVariableSummary selected : processInstances) {}

      // remove last ,
      if (processIdsParam.length() > 0) {
        processIdsParam.deleteCharAt(processIdsParam.length() - 1);
      }
    } else {
      processIdsParam.append("-1");
    }
    PlaceRequest placeRequestImpl = new DefaultPlaceRequest("Signal Process Popup");
    placeRequestImpl.addParameter("processInstanceId", processIdsParam.toString());

    placeManager.goTo(placeRequestImpl);
    view.displayNotification(constants.Signaling_Process_Instance());
  }
 @Override
 protected void updateRefreshInterval(boolean enableAutoRefresh, int newInterval) {
   super.updateRefreshInterval(enableAutoRefresh, newInterval);
   view.saveRefreshValue(newInterval);
 }
 @Override
 public void onGridPreferencesStoreLoaded() {
   refreshSelectorMenuBuilder.loadOptions(view.getRefreshValue());
 }
  @Override
  public void getData(final Range visibleRange) {
    try {
      if (!isAddingDefaultFilters()) {
        FilterSettings currentTableSettings = dataSetQueryHelper.getCurrentTableSettings();
        if (currentTableSettings != null) {
          currentTableSettings.setTablePageSize(view.getListGrid().getPageSize());
          ColumnSortList columnSortList = view.getListGrid().getColumnSortList();
          // GWT.log( "-----PIVarList getData table name " + currentTableSettings.getTableName() );
          if (columnSortList != null && columnSortList.size() > 0) {
            dataSetQueryHelper.setLastOrderedColumn(
                (columnSortList.size() > 0)
                    ? columnSortList.get(0).getColumn().getDataStoreName()
                    : "");
            dataSetQueryHelper.setLastSortOrder(
                (columnSortList.size() > 0) && columnSortList.get(0).isAscending()
                    ? SortOrder.ASCENDING
                    : SortOrder.DESCENDING);
          } else {
            dataSetQueryHelper.setLastOrderedColumn(
                DataSetProcessInstanceListVariableViewImpl.VARIABLE_NAME);
            dataSetQueryHelper.setLastSortOrder(SortOrder.ASCENDING);
          }

          if (textSearchStr != null && textSearchStr.trim().length() > 0) {

            DataSetFilter filter = new DataSetFilter();
            List<ColumnFilter> filters = new ArrayList<ColumnFilter>();
            filters.add(
                likeTo(
                    DataSetProcessInstanceListVariableViewImpl.PROCESS_NAME,
                    "%" + textSearchStr.toLowerCase() + "%",
                    false));
            filters.add(
                likeTo(
                    DataSetProcessInstanceListVariableViewImpl.PROCESS_INSTANCE_ID,
                    "%" + textSearchStr.toLowerCase() + "%",
                    false));
            filters.add(
                likeTo(
                    DataSetProcessInstanceListVariableViewImpl.VARIABLE_VALUE,
                    "%" + textSearchStr.toLowerCase() + "%",
                    false));
            filter.addFilterColumn(OR(filters));

            if (currentTableSettings.getDataSetLookup().getFirstFilterOp() != null) {
              currentTableSettings
                  .getDataSetLookup()
                  .getFirstFilterOp()
                  .addFilterColumn(OR(filters));
            } else {
              currentTableSettings.getDataSetLookup().addOperation(filter);
            }
            textSearchStr = "";
          }
          dataSetQueryHelper.setDataSetHandler(currentTableSettings);
          dataSetQueryHelper.lookupDataSet(
              visibleRange.getStart(),
              new DataSetReadyCallback() {
                @Override
                public void callback(DataSet dataSet) {
                  if (dataSet != null) {
                    List<ProcessInstanceVariableSummary> myProcessInstancesFromDataSet =
                        new ArrayList<ProcessInstanceVariableSummary>();

                    for (int i = 0; i < dataSet.getRowCount(); i++) {
                      myProcessInstancesFromDataSet.add(
                          new ProcessInstanceVariableSummary(
                              dataSetQueryHelper.getColumnLongValue(
                                  dataSet,
                                  DataSetProcessInstanceListVariableViewImpl.PROCESS_INSTANCE_ID,
                                  i),
                              dataSetQueryHelper.getColumnStringValue(
                                  dataSet,
                                  DataSetProcessInstanceListVariableViewImpl.PROCESS_NAME,
                                  i),
                              dataSetQueryHelper.getColumnLongValue(
                                  dataSet,
                                  DataSetProcessInstanceListVariableViewImpl.VARIABLE_ID,
                                  i),
                              dataSetQueryHelper.getColumnStringValue(
                                  dataSet,
                                  DataSetProcessInstanceListVariableViewImpl.VARIABLE_NAME,
                                  i),
                              dataSetQueryHelper.getColumnStringValue(
                                  dataSet,
                                  DataSetProcessInstanceListVariableViewImpl.VARIABLE_VALUE,
                                  i)));
                    }
                    PageResponse<ProcessInstanceVariableSummary>
                        processInstanceSummaryPageResponse =
                            new PageResponse<ProcessInstanceVariableSummary>();
                    processInstanceSummaryPageResponse.setPageRowList(
                        myProcessInstancesFromDataSet);
                    processInstanceSummaryPageResponse.setStartRowIndex(visibleRange.getStart());
                    processInstanceSummaryPageResponse.setTotalRowSize(
                        dataSet.getRowCountNonTrimmed());
                    processInstanceSummaryPageResponse.setTotalRowSizeExact(true);
                    if (visibleRange.getStart() + dataSet.getRowCount()
                        == dataSet.getRowCountNonTrimmed()) {
                      processInstanceSummaryPageResponse.setLastPage(true);
                    } else {
                      processInstanceSummaryPageResponse.setLastPage(false);
                    }
                    DataSetProcessInstanceVariableListPresenter.this.updateDataOnCallback(
                        processInstanceSummaryPageResponse);
                  }
                  view.hideBusyIndicator();
                }

                @Override
                public void notFound() {
                  view.hideBusyIndicator();
                  errorPopup.showMessage(
                      "Not found DataSet with UUID [  "
                          + PROCESS_INSTANCE_WITH_VARIABLES_DATASET
                          + " ] ");
                  GWT.log(
                      "DataSet with UUID [  "
                          + PROCESS_INSTANCE_WITH_VARIABLES_DATASET
                          + " ] not found.");
                }

                @Override
                public boolean onError(final ClientRuntimeError error) {
                  view.hideBusyIndicator();
                  errorPopup.showMessage(
                      "DataSet with UUID [  "
                          + PROCESS_INSTANCE_WITH_VARIABLES_DATASET
                          + " ] error: "
                          + error.getThrowable());
                  GWT.log(
                      "DataSet with UUID [  "
                          + PROCESS_INSTANCE_WITH_VARIABLES_DATASET
                          + " ] error: ",
                      error.getThrowable());
                  return false;
                }
              });
        } else {
          view.hideBusyIndicator();
        }
      }
    } catch (Exception e) {
      GWT.log(
          "Error looking up dataset with UUID [ " + PROCESS_INSTANCE_WITH_VARIABLES_DATASET + " ]");
    }
  }