Skip to content

Commit

Permalink
修复复制分组与切换分组时导致配置信息被意外清空BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
makejavas committed Jul 26, 2018
1 parent d27532f commit b6a61be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/sjhy/plugin/comm/AbstractTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public void init(List<T> data) {
if (CollectionUtil.isEmpty(data)) {
return;
}
this.data = data;
// 先移除后赋值,修复复制分组后无数据展示问题
removeAllRow();
this.data = data;
data.forEach(item -> super.addRow(toObj(item)));
}

Expand All @@ -49,7 +50,8 @@ private void removeAllRow() {
int rowCount = getRowCount();
if (rowCount > 0) {
for (int i = 0; i < rowCount; i++) {
removeRow(0);
// 只移除行数据,不移除储存数据,修复切换分组数据自动清空BUG
super.removeRow(0);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/sjhy/plugin/ui/TypeMapperSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TypeMapperSetting implements Configurable {
/**
* 类型映射分组切换下拉框
*/
private JComboBox typeMapperComboBox;
private JComboBox<String> typeMapperComboBox;
/**
* 分组复制按钮
*/
Expand Down Expand Up @@ -166,7 +166,6 @@ private void refresh() {
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());
Expand Down

0 comments on commit b6a61be

Please sign in to comment.