Browse Source

Pull request #15468: REPORT-140563 & REPORT-140371 & REPORT-140299 & REPORT-140453 & REPORT-140634

Merge in DESIGN/design from ~DESTINY.LIN/design:release/11.0 to release/11.0

* commit '8cc71df412c5bbd1c14cf7cb6c7c8875cb9e60c1':
  REPORT-140634 【数据集替换】下拉树和视图树的数据集替换都不行
  REPORT-140453 【数据集替换】自定义校验的属性公式没有替换成功
  REPORT-140299 【数据集替换】数据列-高级-自定义显示中,没有替换
  REPORT-140371 【数据集替换】条件属性的形态-数据字典的数据集没有替换
  REPORT-140563 【数据集替换】参数面板所有控件的控件值字段,都没有替换
release/11.0
parent
commit
6bfc784212
  1. 3
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchDSColumnFormulaAction.java
  2. 18
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormulaAction.java
  3. 112
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java

3
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/cell/SearchDSColumnFormulaAction.java

@ -58,8 +58,7 @@ public class SearchDSColumnFormulaAction implements SearchCellFormula {
}
private void addFormulaInfos2ArrayFromResult(ITContent content, DSColumn dsColumn, List<FormulaInfo> formulaInfos) {
char formulaLabel = '=';
if (dsColumn.getResult() != null && dsColumn.getResult().length() > 0 && dsColumn.getResult().charAt(0) == formulaLabel) {
if (dsColumn.getResult() != null && dsColumn.getResult().length() > 0) {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(dsColumn);
//高级-显示值

18
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormulaAction.java

@ -22,6 +22,7 @@ import com.fr.report.write.ReportWriteAttr;
import com.fr.report.write.SubmitVisitor;
import com.fr.report.write.ValueVerifier;
import com.fr.report.write.WClassSubmiter;
import com.fr.report.write.WClassVerifier;
import com.fr.stable.CommonUtils;
import com.fr.stable.ListMap;
@ -106,14 +107,29 @@ public class SearchTemplateFormulaAction implements SearchTemplateFormula {
//数据校验
for (int i = 0, len = attr.getVerifierCount(); i < len; i++) {
Verifier verifier = attr.getVerifier(i);
if (verifier instanceof ValueVerifier) {
ITContent content = ITContent.copy(sheetContent);
content.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Verify_Data_Verify"));
if (verifier instanceof ValueVerifier) {
dealValueVerifier4Formula(formulaInfos, content, (ValueVerifier) verifier);
} else if (verifier instanceof WClassVerifier) {
dealWClassVerifier(formulaInfos, content, (WClassVerifier)verifier);
}
}
}
}
private void dealWClassVerifier(List<FormulaInfo> formulaInfos, ITContent content, WClassVerifier verifier) {
if (verifier.getClassVerifyJob() != null) {
ListMap map = verifier.getClassVerifyJob().getPropertyMap();
for (Object value : map.values()) {
if (value instanceof Formula) {
ITContent formulaContent = ITContent.copy(content);
formulaContent.setReplaceObject(value);
formulaInfos.add(new FormulaInfo(formulaContent));
}
}
}
}
private void dealValueVerifier4Formula(List<FormulaInfo> formulaInfos, ITContent content, ValueVerifier verifier) {

112
designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java

@ -11,6 +11,8 @@ import com.fr.data.condition.ListCondition;
import com.fr.data.core.Compare;
import com.fr.data.impl.NameTableData;
import com.fr.data.impl.TableDataDictionary;
import com.fr.data.impl.TreeNodeAttr;
import com.fr.data.impl.TreeNodeWrapper;
import com.fr.design.actions.replace.action.content.cell.SearchCellAction;
import com.fr.design.actions.replace.action.content.formula.SearchFormulaManager;
import com.fr.design.actions.replace.action.content.formula.cell.SearchCellFormulaAction;
@ -26,20 +28,32 @@ import com.fr.design.actions.replace.info.WidgetInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.FormElementCaseProvider;
import com.fr.form.data.DataBinding;
import com.fr.form.ui.DataControl;
import com.fr.form.ui.DictionaryContainer;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.TreeEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.concept.data.ValueInitializer;
import com.fr.form.ui.tree.LayerConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.data.Condition;
import com.fr.general.data.TableDataColumn;
import com.fr.js.JavaScript;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.main.impl.WorkBook;
import com.fr.main.parameter.ReportParameterAttr;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.highlight.DefaultHighlight;
import com.fr.report.cell.cellattr.highlight.Highlight;
import com.fr.report.cell.cellattr.highlight.HighlightGroup;
import com.fr.report.cell.cellattr.highlight.HyperlinkHighlightAction;
import com.fr.report.cell.cellattr.highlight.PresentHighlightAction;
import com.fr.report.cell.cellattr.highlight.WidgetHighlightAction;
import com.fr.report.elementcase.ElementCase;
import com.fr.report.report.Report;
import com.fr.report.utils.ElementCaseHelper;
@ -297,6 +311,51 @@ public class ReplaceUtils {
replaceJs(javaScripts, entities);
}
private static void replaceCellHighlight(CellElement cell, List<TableReplacementEntity> entities) {
if (cell instanceof TemplateCellElement) {
HighlightGroup group = ((TemplateCellElement) cell).getHighlightGroup();
if (group != null) {
for (int i = 0 ; i < group.size(); i++) {
Highlight highlight = group.getHighlight(i);
replaceHighlight(highlight, entities);
}
}
}
}
private static void replaceHighlight(Highlight highlight, List<TableReplacementEntity> entities) {
if (highlight instanceof DefaultHighlight) {
DefaultHighlight defaultHighlight = (DefaultHighlight) highlight;
for (int i = 0 ; i < defaultHighlight.actionCount() ; i++) {
if (defaultHighlight.getHighlightAction(i) instanceof PresentHighlightAction) {
PresentHighlightAction action = (PresentHighlightAction) defaultHighlight.getHighlightAction(i);
ElementCaseHelper.replacePresent(action.getPresent(), entities);
} else if (defaultHighlight.getHighlightAction(i) instanceof WidgetHighlightAction) {
WidgetHighlightAction action = (WidgetHighlightAction) defaultHighlight.getHighlightAction(i);
replaceWidget(action.getWidget(), entities);
} else if (defaultHighlight.getHighlightAction(i) instanceof HyperlinkHighlightAction) {
HyperlinkHighlightAction action = (HyperlinkHighlightAction) defaultHighlight.getHighlightAction(i);
NameJavaScriptGroup group = action.getHperlink();
dealNameJavaScriptGroup(group, entities);
}
}
}
}
private static void dealNameJavaScriptGroup(NameJavaScriptGroup group, List<TableReplacementEntity> entities) {
if (group != null) {
for (int i = 0 ; i < group.size(); i++) {
NameJavaScript javaScript = group.getNameHyperlink(i);
if (javaScript.getJavaScript() instanceof ChartHyperPoplink) {
if (((ChartHyperPoplink) javaScript.getJavaScript()).getChartCollection() instanceof ChartCollection) {
replaceChart((ChartCollection) ((ChartHyperPoplink) javaScript.getJavaScript()).getChartCollection(), entities);
}
}
}
}
}
private static void replaceJs(List<JavaScript> javaScripts, List<TableReplacementEntity> entity) {
for (JavaScript javaScript : javaScripts) {
@ -403,6 +462,8 @@ public class ReplaceUtils {
replacePresentAndDictionary(cell, entity);
// 处理【单元格值】
replaceCellValue(cell, entity);
// 处理【条件属性】
replaceCellHighlight(cell, entity);
}
}
@ -485,6 +546,10 @@ public class ReplaceUtils {
private static void replaceWidget(Widget widget, List<TableReplacementEntity> entities) {
if (widget instanceof DictionaryContainer) {
DictionaryContainer db = (DictionaryContainer) widget;
if (widget instanceof TreeEditor) {
Object config = ((TreeEditor) widget).getBuildModelConfig();
replaceTreeConfig(config, entities);
}
if (db.getDictionary() instanceof TableDataDictionary) {
TableDataDictionary tdd = (TableDataDictionary) db.getDictionary();
NameTableData ndd = (NameTableData) tdd.getTableData();
@ -492,6 +557,53 @@ public class ReplaceUtils {
ElementCaseHelper.replaceTableDataDictionary(tdd, ndd, entities);
}
}
if (widget instanceof DataControl) {
ValueInitializer value = ((DataControl) widget).getWidgetValue();
if (value.getValue() instanceof DataBinding) {
DataBinding binding = (DataBinding) value.getValue();
for (TableReplacementEntity entity : entities) {
if (StringUtils.equals(entity.getOldName(), binding.getDataSourceName())) {
value.setValue(new DataBinding(entity.getNewName(), entity.getTargetField(binding.getDataBindingKey())));
break;
}
}
}
}
}
private static void replaceTreeConfig(Object config, List<TableReplacementEntity> entities) {
if (config instanceof LayerConfig[]) {
LayerConfig[] layerConfigs = (LayerConfig[]) config;
dealWithLayerConfigs(layerConfigs, entities);
} else if (config instanceof TreeNodeWrapper) {
TreeNodeWrapper wrapper = (TreeNodeWrapper) config;
dealWithTreeNodeWrapper(wrapper, entities);
} else if (config instanceof TableDataDictionary) {
TableDataDictionary tableDataDictionary = (TableDataDictionary) config;
ElementCaseHelper.replaceTableDataDictionary(tableDataDictionary, (NameTableData) tableDataDictionary.getTableData(), entities);
}
}
private static void dealWithTreeNodeWrapper(TreeNodeWrapper wrapper, List<TableReplacementEntity> entities) {
for (TreeNodeAttr attr : wrapper.getTreeNodeAttrs()) {
if (attr.getDictionary() instanceof TableDataDictionary) {
TableDataDictionary tableDataDictionary = (TableDataDictionary) attr.getDictionary();
ElementCaseHelper.replaceTableDataDictionary(tableDataDictionary, (NameTableData) tableDataDictionary.getTableData(), entities);
}
}
}
private static void dealWithLayerConfigs(LayerConfig[] layerConfigs, List<TableReplacementEntity> entities) {
for (LayerConfig layerConfig : layerConfigs) {
if (layerConfig.getDictionary() != null ) {
for (TableReplacementEntity entity : entities) {
if (layerConfig.getTableData() instanceof NameTableData && StringUtils.equals(layerConfig.getTableData().getName(), entity.getOldName())) {
layerConfig.setTableData(new NameTableData(entity.getNewName()));
}
}
ElementCaseHelper.replaceTableDataDictionary(layerConfig.getDictionary(), (NameTableData) layerConfig.getDictionary().getTableData(), entities);
}
}
}
/**

Loading…
Cancel
Save