From e80c07a48207983a1ff117503910979f1179e3cc Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 20 Feb 2021 12:02:10 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-46723=20=E5=A1=AB=E6=8A=A5=E6=99=BA?= =?UTF-8?q?=E8=83=BD=E6=B7=BB=E5=8A=A0=E5=8D=95=E5=85=83=E6=A0=BC=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../submit/SmartInsertDBManipulationPane.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index d306bb179..12c610534 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -310,9 +310,9 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { // 单元格组要记录下之前的选中情况 private CellSelection oriCellSelection = null; - private List newAdd = new ArrayList(); + private List newAdd = new ArrayList<>(); - private List oldAdd = new ArrayList(); + private List oldAdd = new ArrayList<>(); public SmartJTablePane4DB(KeyColumnTableModel model, ElementCasePane actionReportPane) { this(model, actionReportPane, false); @@ -433,7 +433,8 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (!allColumnRow.contains(columnRow.toString())) { add.addColumnRow(columnRow); } - + // 重新更换区域框选单元格后 清理历史框选 + oldAdd.clear(); } if (add.getSize() > 0) { @@ -462,7 +463,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (!newAdd.contains(value) && !allColumnRow.contains(value)) { add.addColumnRow(ColumnRow.valueOf(value)); } - newAdd.add(value); + newAdd.add(ColumnRow.valueOf(value)); } if (cellElement == null) { @@ -470,16 +471,14 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { if (!allColumnRow.contains(columnRow.toString())) { add.addColumnRow(columnRow); } - newAdd.add(columnRow.toString()); + newAdd.add(columnRow); } } } - int oldSize = oldAdd.size(); - int newSize = newAdd.size(); - if (oldSize > newSize && oldAdd.containsAll(newAdd)) { - int diff = oldSize - newSize; - newValue.splice(newValue.getSize() - diff, diff); - } + // 计算出前后两次选中的差值 + oldAdd.removeAll(newAdd); + // 移除差值部分 + newValue.removeAll(oldAdd); oldAdd.clear(); oldAdd.addAll(newAdd); }