Browse Source

Pull request #8023: KERNEL-10259 报表参数逻辑重构

Merge in DESIGN/design from ~HOKY.HE/design-hoky:feature/x to feature/x

* commit '0dea88f5a0e09ea5e86659aa44c3704b268deef4':
  KERNEL-10259 报表参数逻辑重构 1.参数来源收集器
feature/x
Hoky.He 3 years ago
parent
commit
a94842e375
  1. 13
      designer-base/src/main/java/com/fr/design/DesignModelAdapter.java
  2. 7
      designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java
  3. 5
      designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java

13
designer-base/src/main/java/com/fr/design/DesignModelAdapter.java

@ -4,6 +4,7 @@ import com.fr.base.Parameter;
import com.fr.base.ParameterConfig;
import com.fr.base.TableData;
import com.fr.base.io.BaseBook;
import com.fr.base.param.ParameterSource;
import com.fr.data.TableDataSource;
import com.fr.data.operator.DataOperator;
import com.fr.design.file.HistoryTemplateListCache;
@ -19,8 +20,8 @@ import com.fr.stable.Filter;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.js.WidgetName;
import com.fr.util.ParameterApplyHelper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -283,9 +284,9 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
TableData tableData = this.getBook().getTableData(name);
ParameterProvider[] parameterProviders = DataOperator.getInstance().getTableDataParameters(tableData);
if (filter != null) {
ParameterApplyHelper.addPara2Map(map, parameterProviders, filter);
ParameterApplyHelper.addPara2Map(map, parameterProviders, filter, null, ParameterSource.DEFAULT_SOURCE);
} else {
ParameterApplyHelper.addPara2Map(map, parameterProviders);
ParameterApplyHelper.addPara2Map(map, parameterProviders, null, ParameterSource.TEMPLATE_SOURCE);
}
tableDataParametersMap.put(name, parameterProviders);
}
@ -353,9 +354,9 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
*/
private void updateParaMap(Map<String, ParameterProvider> map, ParameterProvider[] parameterProviders, Filter<ParameterProvider> filter) {
if (filter != null) {
ParameterApplyHelper.addPara2Map(map, parameterProviders, filter);
ParameterApplyHelper.addPara2Map(map, parameterProviders, filter, null, ParameterSource.DEFAULT_SOURCE);
} else {
ParameterApplyHelper.addPara2Map(map, parameterProviders);
ParameterApplyHelper.addPara2Map(map, parameterProviders, null, ParameterSource.DEFAULT_SOURCE);
}
}
@ -378,7 +379,7 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
protected void addGlobalParameters(Map<String, ParameterProvider> map) {
// 添加全局参数
Parameter[] glbParas = ParameterConfig.getInstance().getGlobalParameters();
ParameterApplyHelper.addPara2Map(map, glbParas);
ParameterApplyHelper.addPara2Map(map, glbParas, null, ParameterSource.GLOBAL_SOURCE);
}

7
designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.Parameter;
import com.fr.base.TableData;
import com.fr.base.param.ParameterSource;
import com.fr.data.TableDataSource;
import com.fr.design.DesignModelAdapter;
import com.fr.design.file.HistoryTemplateListPane;
@ -14,8 +15,8 @@ import com.fr.script.Calculator;
import com.fr.stable.EmbParaFilter;
import com.fr.stable.ParameterProvider;
import com.fr.stable.js.WidgetName;
import com.fr.util.ParameterApplyHelper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -55,7 +56,7 @@ public class FormModelAdapter extends DesignModelAdapter<Form, BaseJForm<Form>>
Map<String, ParameterProvider> map = new HashMap<>();
addGlobalParameters(map);
updateTableDataParameters(oldName, tdName, tableData, map, parameterProvider -> !EmbParaFilter.isFRLayerTypePara(parameterProvider));
ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters());
ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters(), null, ParameterSource.DEFAULT_SOURCE);
parameters = map.values().toArray(new Parameter[0]);
jTemplate.populateParameter();
}
@ -158,7 +159,7 @@ public class FormModelAdapter extends DesignModelAdapter<Form, BaseJForm<Form>>
addTableDataParameters(map, parameterProvider -> !EmbParaFilter.isFRLayerTypePara(parameterProvider));
ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters());
ParameterApplyHelper.addPara2Map(map, this.getBook().getTemplateParameters(), null, ParameterSource.DEFAULT_SOURCE);
return map.values().toArray(new Parameter[0]);
}

5
designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.Parameter;
import com.fr.base.TableData;
import com.fr.base.param.ParameterSource;
import com.fr.data.TableDataSource;
import com.fr.design.DesignModelAdapter;
import com.fr.design.bridge.DesignToolbarProvider;
@ -17,8 +18,8 @@ import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.js.WidgetName;
import com.fr.util.ParameterApplyHelper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@ -139,7 +140,7 @@ public class WorkBookModelAdapter extends DesignModelAdapter<WorkBook, JWorkBook
// 添加模板参数
ReportParameterAttr parameterAttr = this.getBook().getReportParameterAttr();
if (parameterAttr != null) {
ParameterApplyHelper.addPara2Map(map, parameterAttr.getParameters());
ParameterApplyHelper.addPara2Map(map, parameterAttr.getParameters(), null, ParameterSource.TEMPLATE_SOURCE);
}
}

Loading…
Cancel
Save