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