From c62d253b99f0c20e8cdc15c82ab05eb53aa635c1 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 14 Nov 2024 14:44:32 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-140371=20=E3=80=90=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E6=9B=BF=E6=8D=A2=E3=80=91=E6=9D=A1=E4=BB=B6=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E7=9A=84=E5=BD=A2=E6=80=81-=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9B=86=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/replace/utils/ReplaceUtils.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java index db768e5be6..2d51125f5b 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java +++ b/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 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 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 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 javaScripts, List entity) { for (JavaScript javaScript : javaScripts) { @@ -406,6 +458,8 @@ public class ReplaceUtils { replacePresentAndDictionary(cell, entity); // 处理【单元格值】 replaceCellValue(cell, entity); + // 处理【条件属性】 + replaceCellHighlight(cell, entity); } }