Browse Source

REPORT-140371 【数据集替换】条件属性的形态-数据字典的数据集没有替换

release/11.0
Destiny.Lin 1 week ago
parent
commit
c62d253b99
  1. 54
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java

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

@ -37,12 +37,19 @@ 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;
@ -300,6 +307,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) {
@ -406,6 +458,8 @@ public class ReplaceUtils {
replacePresentAndDictionary(cell, entity);
// 处理【单元格值】
replaceCellValue(cell, entity);
// 处理【条件属性】
replaceCellHighlight(cell, entity);
}
}

Loading…
Cancel
Save