Browse Source

REPORT-71449 【冒烟】不复制新的数据集,“剪贴版”的数据集会变化

【问题原因】粘贴的时候没有做clone处理,假如修改粘贴后的数据集,会同步修改掉剪切板里存的Tableda
【改动思路】添加粘贴时TableData的clone逻辑
【review建议】
new-design
Yvan 3 years ago
parent
commit
66cea01ce1
  1. 5
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  2. 14
      designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java

5
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -1133,7 +1133,10 @@ public class TableDataTreePane extends BasicTableDataTreePane {
// 处理数据集名称
String dsName = getNoRepeatedDsName4Paste(dataWrapperEntry.getKey());
AbstractTableDataWrapper wrapper = dataWrapperEntry.getValue();
addDataPane(TableDataFollowingPasteUtils.generateTableDataPaneWhenPaste(wrapper), dsName);
AbstractTableDataPane<?> tableDataPane = TableDataFollowingPasteUtils.generateTableDataPaneWhenPaste(wrapper);
if (tableDataPane != null) {
addDataPane(tableDataPane, dsName);
}
}
}
}

14
designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java

@ -66,7 +66,10 @@ public class TableDataFollowingPasteUtils {
continue;
}
AbstractTableDataWrapper tableDataWrapper = new TemplateTableDataWrapper(dataWrapperEntry.getValue(), dsName);
tableDataTreePane.addDataPane(generateTableDataPaneWhenPaste(tableDataWrapper), dsName);
AbstractTableDataPane<?> tableDataPane = generateTableDataPaneWhenPaste(tableDataWrapper);
if (tableDataPane != null) {
tableDataTreePane.addDataPane(tableDataPane, dsName);
}
}
}
@ -372,11 +375,16 @@ public class TableDataFollowingPasteUtils {
* 生成粘贴新建时使用的AbstractTableDataPane
* 主要是为了处理StoreProcedure它在远程情况下无法及时获取参数这边因为是复制粘贴所以直接用原TableData的参数即可
* @param tableDataWrapper wrapper
* @return AbstractTableDataPane
* @return AbstractTableDataPane,当TableData clone失败时方法返回null
*/
@Nullable
public static AbstractTableDataPane<?> generateTableDataPaneWhenPaste(AbstractTableDataWrapper tableDataWrapper) {
// 粘贴时再做一次TableData的clone
AbstractTableDataWrapper clonedWrapper = new TemplateTableDataWrapper(cloneTableData(tableDataWrapper.getTableData()));
TableData clonedTableData = cloneTableData(tableDataWrapper.getTableData());
if (clonedTableData == null) {
return null;
}
AbstractTableDataWrapper clonedWrapper = new TemplateTableDataWrapper(clonedTableData);
AbstractTableDataPane<?> tableDataPane = clonedWrapper.creatTableDataPane();
TableData tableData = clonedWrapper.getTableData();
if (tableData instanceof StoreProcedure) {

Loading…
Cancel
Save