修复复制分组与切换分组时导致配置信息被意外清空BUG

This commit is contained in:
makejava 2018-07-26 16:15:09 +08:00
parent d27532f73d
commit b6a61be603
2 changed files with 5 additions and 4 deletions

View File

@ -36,8 +36,9 @@ public abstract class AbstractTableModel<T> extends DefaultTableModel {
if (CollectionUtil.isEmpty(data)) {
return;
}
this.data = data;
// 先移除后赋值修复复制分组后无数据展示问题
removeAllRow();
this.data = data;
data.forEach(item -> super.addRow(toObj(item)));
}
@ -49,7 +50,8 @@ public abstract class AbstractTableModel<T> extends DefaultTableModel {
int rowCount = getRowCount();
if (rowCount > 0) {
for (int i = 0; i < rowCount; i++) {
removeRow(0);
// 只移除行数据不移除储存数据修复切换分组数据自动清空BUG
super.removeRow(0);
}
}
}

View File

@ -27,7 +27,7 @@ public class TypeMapperSetting implements Configurable {
/**
* 类型映射分组切换下拉框
*/
private JComboBox typeMapperComboBox;
private JComboBox<String> typeMapperComboBox;
/**
* 分组复制按钮
*/
@ -166,7 +166,6 @@ public class TypeMapperSetting implements Configurable {
init = false;
//初始化下拉框
this.typeMapperComboBox.removeAllItems();
//noinspection unchecked
typeMapperGroupMap.keySet().forEach(this.typeMapperComboBox::addItem);
this.typeMapperComboBox.setSelectedItem(this.currGroupName);
this.typeMapperModel.init(this.typeMapperGroupMap.get(currGroupName).getElementList());