@Override
  @SuppressWarnings("unchecked")
  public void endEdit(boolean result) {
    if (result) {
      // Update the row data
      List<Object> tableData = (List<Object>) tableView.getTableData();
      Object tableRow = tableData.get(rowIndex);
      tablePane.store(tableRow);

      if (tableData.getComparator() == null) {
        tableData.update(rowIndex, tableRow);
      } else {
        tableData.remove(rowIndex, 1);
        tableData.add(tableRow);

        // Re-select the item, and make sure it's visible
        rowIndex = tableData.indexOf(tableRow);
        tableView.setSelectedIndex(rowIndex);
        tableView.scrollAreaToVisible(tableView.getRowBounds(rowIndex));
      }
    }

    if (cardPane.getSelectedIndex() == EDITOR_CARD_INDEX) {
      cardPane.setSelectedIndex(IMAGE_CARD_INDEX);
    } else {
      // Remove the editor components
      TablePane.ColumnSequence tablePaneColumns = tablePane.getColumns();
      tablePaneColumns.remove(0, tablePaneColumns.getLength());
      editorRow.remove(0, editorRow.getLength());

      getOwner().moveToFront();
      tableView.requestFocus();

      tableView = null;
      rowIndex = -1;
      columnIndex = -1;

      tableViewScrollPane = null;

      close();
    }
  }