@Override
  protected boolean performLeavingAction(WizardStepDirection direction) {
    if (direction == WizardStepDirection.FINISH) {
      try {
        if (state.getTranslator() != null) {
          state.getTranslator().close();
        }
      } catch (OperatorException e) {
        ImportWizardUtils.showErrorMessage(
            state.getDataResultSetFactory().getResourceName(), e.toString(), e);
      }

      // use settings edited by user even if he never pressed Enter or otherwise confirmed his
      // changes
      for (int i = 0; i < previewTable.getColumnCount(); i++) {
        EditableTableHeaderColumn col =
            (EditableTableHeaderColumn) previewTable.getColumnModel().getColumn(i);
        if (col.getHeaderEditor() instanceof MetaDataTableHeaderCellEditor) {
          MetaDataTableHeaderCellEditor editor =
              (MetaDataTableHeaderCellEditor) col.getHeaderEditor();
          editor.updateColumnMetaData();
        }
      }
    }
    return true;
  }
  private void updateTableModel(ExampleSet exampleSet) {
    if (previewTable == null) {
      previewTable = new ExtendedJTable(false, false, false);
    }

    // data model
    DataTableViewerTableModel model =
        new DataTableViewerTableModel(new DataTableExampleSetAdapter(exampleSet, null));
    List<Integer> rowsList = new LinkedList<Integer>();
    int lastHit = -1;
    for (ParsingError error : state.getTranslator().getErrors()) {
      if (error.getExampleIndex() != lastHit) {
        rowsList.add(error.getExampleIndex());
        lastHit = error.getExampleIndex();
      }
    }
    int[] rowMap = new int[rowsList.size()];
    int j = 0;
    for (Integer row : rowsList) {
      rowMap[j++] = row;
    }
    filteredModel = new RowFilteringTableModel(model, rowMap, filterErrorsBox.isSelected());
    previewTable.setModel(filteredModel);

    // Header model

    TableColumnModel columnModel = previewTable.getColumnModel();
    previewTable.setTableHeader(new EditableTableHeader(columnModel));
    // header editors and renderers and values
    MetaDataTableHeaderCellEditor headerRenderer = new MetaDataTableHeaderCellEditor();
    MetaDataTableHeaderCellEditor headerEditor = new MetaDataTableHeaderCellEditor(headerValidator);
    headerValidator.addHeaderRenderer(headerRenderer);
    for (int i = 0; i < previewTable.getColumnCount(); i++) {
      EditableTableHeaderColumn col =
          (EditableTableHeaderColumn) previewTable.getColumnModel().getColumn(i);
      col.setHeaderValue(state.getTranslationConfiguration().getColumnMetaData()[i]);
      col.setHeaderRenderer(headerRenderer);
      col.setHeaderEditor(headerEditor);
    }
    previewTable.getTableHeader().setReorderingAllowed(false);

    previewTable.setCellColorProvider(
        new CellColorProviderAlternating() {

          @Override
          public Color getCellColor(int row, int column) {
            row = filteredModel.translateRow(row);
            ParsingError error = state.getTranslator().getErrorByExampleIndexAndColumn(row, column);
            if (error != null) {
              return SwingTools.DARK_YELLOW;
            } else {
              return super.getCellColor(row, column);
            }
          }
        });
    tableScrollPane.setViewportView(previewTable);
  }