Browse Source

Pull request #8369: REPORT-68803 【迭代】【数据集管理优化】复制单元格,已存在同名数据集,数据集不需要跟随复制

Merge in DESIGN/design from ~YVAN/design:feature/x to feature/x

* commit '0ede1880b881a111c85967acfa47101f946405f1':
  REPORT-68803 【迭代】【数据集管理优化】复制单元格,已存在同名数据集,数据集不需要跟随复制 【问题原因】rt 【改动思路】修改为存在同名时,不跟随复制 【review建议】无
feature/x
Yvan 3 years ago
parent
commit
0a810d8829
  1. 14
      designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java

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

@ -16,7 +16,9 @@ import com.fr.form.ui.DictionaryContainer;
import com.fr.form.ui.Widget;
import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.report.cell.tabledata.ElementUsedTableDataProvider;
import com.fr.stable.StringUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -43,15 +45,23 @@ public class TableDataFollowingPasteUtils {
TableDataTreePane tableDataTreePane = (TableDataTreePane) TableDataTreePane.getInstance(currentModelAdapter);
// 粘贴(添加)数据集
for (Map.Entry<String, TableData> dataWrapperEntry : tableDataWrapperMap.entrySet()) {
String oldName = dataWrapperEntry.getKey();
String dsName = dataWrapperEntry.getKey();
// 处理名称重复情况
String dsName = tableDataTreePane.getNoRepeatedDsName4Paste(oldName);
if (isDsNameRepeated(dsName)) {
continue;
}
AbstractTableDataWrapper tableDataWrapper = new TemplateTableDataWrapper(dataWrapperEntry.getValue(), dsName);
AbstractTableDataPane<?> tableDataPane = tableDataWrapper.creatTableDataPane();
tableDataTreePane.addDataPane(tableDataPane, dsName);
}
}
private static boolean isDsNameRepeated(String dsName) {
DesignModelAdapter<?, ?> currentModelAdapter = DesignModelAdapter.getCurrentModelAdapter();
String[] allDSNames = DesignTableDataManager.getAllDSNames(currentModelAdapter.getBook());
return Arrays.stream(allDSNames).anyMatch(name -> StringUtils.equals(name, dsName));
}
/**
* 处理 ElementUsedTableDataProvider从中获取数据集名称 - 数据集Wrapper 的Map
*

Loading…
Cancel
Save