Fixed copy action bug in table that caused wrong columns to get copied

Closes #1628
This commit is contained in:
dragonmacher 2020-09-22 12:05:00 -04:00
parent 3e57a90f05
commit 76c4017e4a
2 changed files with 5 additions and 4 deletions

View file

@ -1013,15 +1013,16 @@ public class GTable extends JTable {
return updated;
}
private Object getCellValue(int row, int column) {
private Object getCellValue(int row, int viewColumn) {
RowObjectTableModel<Object> rowModel = getRowObjectTableModel();
if (rowModel == null) {
Object value = super.getValueAt(row, column);
Object value = super.getValueAt(row, viewColumn);
return maybeConvertValue(value);
}
Object rowObject = rowModel.getRowObject(row);
String stringValue = TableUtils.getTableCellStringValue(rowModel, rowObject, column);
int modelColumn = convertColumnIndexToModel(viewColumn);
String stringValue = TableUtils.getTableCellStringValue(rowModel, rowObject, modelColumn);
return maybeConvertValue(stringValue);
}

View file

@ -37,7 +37,7 @@ public class TableUtils {
* @param <ROW_OBJECT> The model's row object type
* @param model the model
* @param rowObject the row object for the row being queried
* @param column the column index
* @param column the column index <b>in the table model</b>
* @return the string value; null if no value can be fabricated
*/
public static <ROW_OBJECT> String getTableCellStringValue(RowObjectTableModel<ROW_OBJECT> model,