Skip to content

Commit b6a61be

Browse files
committed
修复复制分组与切换分组时导致配置信息被意外清空BUG
1 parent d27532f commit b6a61be

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/java/com/sjhy/plugin/comm/AbstractTableModel.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ public void init(List<T> data) {
3636
if (CollectionUtil.isEmpty(data)) {
3737
return;
3838
}
39-
this.data = data;
39+
// 先移除后赋值,修复复制分组后无数据展示问题
4040
removeAllRow();
41+
this.data = data;
4142
data.forEach(item -> super.addRow(toObj(item)));
4243
}
4344

@@ -49,7 +50,8 @@ private void removeAllRow() {
4950
int rowCount = getRowCount();
5051
if (rowCount > 0) {
5152
for (int i = 0; i < rowCount; i++) {
52-
removeRow(0);
53+
// 只移除行数据,不移除储存数据,修复切换分组数据自动清空BUG
54+
super.removeRow(0);
5355
}
5456
}
5557
}

src/main/java/com/sjhy/plugin/ui/TypeMapperSetting.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class TypeMapperSetting implements Configurable {
2727
/**
2828
* 类型映射分组切换下拉框
2929
*/
30-
private JComboBox typeMapperComboBox;
30+
private JComboBox<String> typeMapperComboBox;
3131
/**
3232
* 分组复制按钮
3333
*/
@@ -166,7 +166,6 @@ private void refresh() {
166166
init = false;
167167
//初始化下拉框
168168
this.typeMapperComboBox.removeAllItems();
169-
//noinspection unchecked
170169
typeMapperGroupMap.keySet().forEach(this.typeMapperComboBox::addItem);
171170
this.typeMapperComboBox.setSelectedItem(this.currGroupName);
172171
this.typeMapperModel.init(this.typeMapperGroupMap.get(currGroupName).getElementList());

0 commit comments

Comments
 (0)