From ade05d9005e5a3c5e404b29a1398ed453fb0616f Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 3 Jun 2021 16:27:38 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-53211=20&&=20REPORT-53208=20&&=20REPORT-?= =?UTF-8?q?53209=20&&=20REPORT-53207=20=E5=87=A0=E4=B8=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=85=AC=E5=BC=8F=E7=9A=84=E5=9C=BA=E6=99=AF=E6=9C=AA?= =?UTF-8?q?=E8=81=94=E5=8A=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mod/ContentObjectManager.java | 10 ++ .../com/fr/design/mod/ContentReplaceUtil.java | 86 +++++++++++++++-- .../fr/design/mod/ContentReplacerCenter.java | 10 ++ .../impl/change/DSColumnContentChange.java | 6 +- .../CardSwitchButtonContentChange.java | 36 +++++++ .../formula/CellGUIAttrContentChange.java | 35 +++++++ .../formula/FunctionGrouperContentChange.java | 35 +++++++ .../formula/SelectCountContentChange.java | 35 +++++++ .../formula/WidgetTitleContentChange.java | 35 +++++++ ...SColumn4TableDataNameContentReplacer.java} | 5 +- .../DSColumn4WidgetNameContentReplacer.java | 19 ++++ .../mod/impl/repalce/FormulaReplacer.java | 96 +++++++++++++++++++ 12 files changed, 397 insertions(+), 11 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mod/impl/change/formula/CardSwitchButtonContentChange.java create mode 100644 designer-base/src/main/java/com/fr/design/mod/impl/change/formula/CellGUIAttrContentChange.java create mode 100644 designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FunctionGrouperContentChange.java create mode 100644 designer-base/src/main/java/com/fr/design/mod/impl/change/formula/SelectCountContentChange.java create mode 100644 designer-base/src/main/java/com/fr/design/mod/impl/change/formula/WidgetTitleContentChange.java rename designer-base/src/main/java/com/fr/design/mod/impl/repalce/{DSColumnContentReplacer.java => DSColumn4TableDataNameContentReplacer.java} (55%) create mode 100644 designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumn4WidgetNameContentReplacer.java diff --git a/designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java b/designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java index 7b20e6085..b70ea88b0 100644 --- a/designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java +++ b/designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java @@ -10,12 +10,17 @@ import com.fr.data.condition.FormulaCondition; import com.fr.data.impl.FormulaDictionary; import com.fr.data.impl.NameTableData; import com.fr.form.main.FormHyperlink; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.WidgetTitle; import com.fr.invoke.ClassHelper; import com.fr.js.JavaScriptImpl; import com.fr.plugin.chart.base.VanChartHtmlLabel; import com.fr.report.cell.cellattr.CellExpandAttr; +import com.fr.report.cell.cellattr.CellGUIAttr; import com.fr.report.cell.cellattr.core.RichChar; import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.report.cell.cellattr.core.group.FunctionGrouper; +import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.stable.Filter; import java.util.HashSet; import java.util.Map; @@ -60,6 +65,11 @@ public class ContentObjectManager { set.add(FormulaHFElement.class.getName()); set.add(FormulaPresent.class.getName()); set.add(RichChar.class.getName()); + set.add(CardSwitchButton.class.getName()); + set.add(CellGUIAttr.class.getName()); + set.add(SelectCount.class.getName()); + set.add(WidgetTitle.class.getName()); + set.add(FunctionGrouper.class.getName()); } public void searchObject(Object ob) { diff --git a/designer-base/src/main/java/com/fr/design/mod/ContentReplaceUtil.java b/designer-base/src/main/java/com/fr/design/mod/ContentReplaceUtil.java index 64027a22c..526280027 100644 --- a/designer-base/src/main/java/com/fr/design/mod/ContentReplaceUtil.java +++ b/designer-base/src/main/java/com/fr/design/mod/ContentReplaceUtil.java @@ -51,26 +51,42 @@ public class ContentReplaceUtil { } } + /** + * 通过公式编辑框框输入的且带有"=" + * + * @param content + * @param oldName + * @param newName + * @return + */ public static String replaceFormulaContent4WidgetName(String content, String oldName, String newName) { if (StringUtils.isNotEmpty(content)) { - content = getFormulaPureContent(content); - FRFormulaTransformer frFormulaTransformer = new FRFormulaTransformer(); - frFormulaTransformer.addRenamedWidget(oldName, newName); - return EQ_STRING + frFormulaTransformer.transform(content); + return replaceFormulaContent4WidgetName0(content, oldName, newName); } return content; } public static String replaceFormulaContent4TableDataName(String content, String oldName, String newName) { if (StringUtils.isNotEmpty(content)) { - content = getFormulaPureContent(content); - FRFormulaTransformer frFormulaTransformer = new FRFormulaTransformer(); - frFormulaTransformer.addRenamedDataset(oldName, newName); - return EQ_STRING + frFormulaTransformer.transform(content); + return replaceFormulaContent4TableDataName0(content, oldName, newName); } return content; } + private static String replaceFormulaContent4WidgetName0(String content, String oldName, String newName) { + content = getFormulaPureContent(content); + FRFormulaTransformer frFormulaTransformer = new FRFormulaTransformer(); + frFormulaTransformer.addRenamedWidget(oldName, newName); + return EQ_STRING + frFormulaTransformer.transform(content); + } + + private static String replaceFormulaContent4TableDataName0(String content, String oldName, String newName) { + content = getFormulaPureContent(content); + FRFormulaTransformer frFormulaTransformer = new FRFormulaTransformer(); + frFormulaTransformer.addRenamedWidget(oldName, newName); + return EQ_STRING + frFormulaTransformer.transform(content); + } + public static String getRichCharFormulaPureContent(String content) { if (content.startsWith(LEFT_BRACKET)) { return content.substring(LEFT_BRACKET.length() + 1, content.length() - 1); @@ -99,4 +115,58 @@ public class ContentReplaceUtil { return content; } + private static boolean isFormula(String content) { + return StringUtils.isNotEmpty(content) && content.startsWith(EQ_STRING); + } + + /** + * 适用于替换非显示使用的公式的地方 有可能只是文本 需要先判断下 + * 可通过使用位置是否使用公式编辑框区分 + * + * @param content + * @param oldName + * @param newName + * @return + */ + public static String replaceFormulaString4WidgetName(String content, String oldName, String newName) { + if (isFormula(content)) { + return replaceFormulaContent4WidgetName0(content, oldName, newName); + } + return content; + } + + public static String replaceFormulaString4TableDataName(String content, String oldName, String newName ) { + if (isFormula(content)) { + return replaceFormulaContent4TableDataName0(content, oldName, newName); + } + return content; + } + + /** + * 替换纯公式内容 无 "=" + * + * @param content + * @param oldName + * @param newName + * @return + */ + public static String replacePureFormula4WidgetName(String content, String oldName, String newName ) { + if (StringUtils.isNotEmpty(content)) { + FRFormulaTransformer frFormulaTransformer = new FRFormulaTransformer(); + frFormulaTransformer.addRenamedWidget(oldName, newName); + return frFormulaTransformer.transform(content); + } + return content; + } + + public static String replacePureFormula4TableDataName(String content, String oldName, String newName ) { + if (StringUtils.isNotEmpty(content)) { + FRFormulaTransformer frFormulaTransformer = new FRFormulaTransformer(); + frFormulaTransformer.addRenamedDataset(oldName, newName); + return frFormulaTransformer.transform(content); + } + return content; + } + + } diff --git a/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java b/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java index 597f59962..cccc08c9a 100644 --- a/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java +++ b/designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java @@ -8,7 +8,9 @@ import com.fr.design.mod.impl.change.ChartHyperRelateCellLinkContentChange; import com.fr.design.mod.impl.change.ChartHyperRelateFloatLinkContentChange; import com.fr.design.mod.impl.change.DSColumnContentChange; import com.fr.design.mod.impl.change.FormHyperlinkContentChange; +import com.fr.design.mod.impl.change.formula.CardSwitchButtonContentChange; import com.fr.design.mod.impl.change.formula.CellExpandAttrContentChange; +import com.fr.design.mod.impl.change.formula.CellGUIAttrContentChange; import com.fr.design.mod.impl.change.formula.FormulaConditionContentChange; import com.fr.design.mod.impl.change.formula.FormulaContentChange; import com.fr.design.mod.impl.change.JavaScriptContentChange; @@ -18,7 +20,10 @@ import com.fr.design.mod.impl.change.VanChartHtmlLabelContentChange; import com.fr.design.mod.impl.change.formula.FormulaDictionaryContentChange; import com.fr.design.mod.impl.change.formula.FormulaHFElementContentChange; import com.fr.design.mod.impl.change.formula.FormulaPresentContentChange; +import com.fr.design.mod.impl.change.formula.FunctionGrouperContentChange; import com.fr.design.mod.impl.change.formula.RichCharContentChange; +import com.fr.design.mod.impl.change.formula.SelectCountContentChange; +import com.fr.design.mod.impl.change.formula.WidgetTitleContentChange; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; @@ -93,6 +98,11 @@ public class ContentReplacerCenter { contentChangeList.add(new FormulaHFElementContentChange()); contentChangeList.add(new FormulaPresentContentChange()); contentChangeList.add(new RichCharContentChange()); + contentChangeList.add(new CardSwitchButtonContentChange()); + contentChangeList.add(new CellGUIAttrContentChange()); + contentChangeList.add(new SelectCountContentChange()); + contentChangeList.add(new WidgetTitleContentChange()); + contentChangeList.add(new FunctionGrouperContentChange()); } private void onRename(List contentChangeItemList, List contentChangeList) { diff --git a/designer-base/src/main/java/com/fr/design/mod/impl/change/DSColumnContentChange.java b/designer-base/src/main/java/com/fr/design/mod/impl/change/DSColumnContentChange.java index be6e6e4ec..4ca627637 100644 --- a/designer-base/src/main/java/com/fr/design/mod/impl/change/DSColumnContentChange.java +++ b/designer-base/src/main/java/com/fr/design/mod/impl/change/DSColumnContentChange.java @@ -3,7 +3,8 @@ package com.fr.design.mod.impl.change; import com.fr.design.mod.ContentChange; import com.fr.design.mod.ContentReplacer; import com.fr.design.mod.bean.ChangeItem; -import com.fr.design.mod.impl.repalce.DSColumnContentReplacer; +import com.fr.design.mod.impl.repalce.DSColumn4TableDataNameContentReplacer; +import com.fr.design.mod.impl.repalce.DSColumn4WidgetNameContentReplacer; import com.fr.report.cell.cellattr.core.group.DSColumn; import java.util.HashMap; import java.util.Map; @@ -19,7 +20,8 @@ public class DSColumnContentChange implements ContentChange { public DSColumnContentChange() { map = new HashMap<>(); - map.put(ChangeItem.TABLE_DATA_NAME, new DSColumnContentReplacer()); + map.put(ChangeItem.TABLE_DATA_NAME, new DSColumn4TableDataNameContentReplacer()); + map.put(ChangeItem.WIDGET_NAME, new DSColumn4WidgetNameContentReplacer()); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/CardSwitchButtonContentChange.java b/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/CardSwitchButtonContentChange.java new file mode 100644 index 000000000..0f785892d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/CardSwitchButtonContentChange.java @@ -0,0 +1,36 @@ +package com.fr.design.mod.impl.change.formula; + +import com.fr.design.mod.ContentChange; +import com.fr.design.mod.ContentReplacer; +import com.fr.design.mod.bean.ChangeItem; +import com.fr.design.mod.impl.repalce.FormulaReplacer; +import com.fr.form.ui.CardSwitchButton; +import java.util.HashMap; +import java.util.Map; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/6/3 + */ +public class CardSwitchButtonContentChange implements ContentChange { + + + private final Map> map; + + public CardSwitchButtonContentChange() { + map = new HashMap<>(); + map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.CardSwitchButton4WidgetNameContentReplacer); + map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.CardSwitchButton4TableDataNameContentReplacer); + } + + @Override + public String type() { + return CardSwitchButton.class.getName(); + } + + @Override + public Map> changeInfo() { + return map; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/CellGUIAttrContentChange.java b/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/CellGUIAttrContentChange.java new file mode 100644 index 000000000..c969a1e05 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/CellGUIAttrContentChange.java @@ -0,0 +1,35 @@ +package com.fr.design.mod.impl.change.formula; + +import com.fr.design.mod.ContentChange; +import com.fr.design.mod.ContentReplacer; +import com.fr.design.mod.bean.ChangeItem; +import com.fr.design.mod.impl.repalce.FormulaReplacer; +import com.fr.report.cell.cellattr.CellGUIAttr; +import java.util.HashMap; +import java.util.Map; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/6/3 + */ +public class CellGUIAttrContentChange implements ContentChange { + + private Map> map; + + public CellGUIAttrContentChange() { + map = new HashMap<>(); + map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.CellGUIAttr4WidgetNameContentReplacer); + map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.CellGUIAttr4TableDataNameContentReplacer); + } + + @Override + public String type() { + return CellGUIAttr.class.getName(); + } + + @Override + public Map> changeInfo() { + return map; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FunctionGrouperContentChange.java b/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FunctionGrouperContentChange.java new file mode 100644 index 000000000..33947c832 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FunctionGrouperContentChange.java @@ -0,0 +1,35 @@ +package com.fr.design.mod.impl.change.formula; + +import com.fr.design.mod.ContentChange; +import com.fr.design.mod.ContentReplacer; +import com.fr.design.mod.bean.ChangeItem; +import com.fr.design.mod.impl.repalce.FormulaReplacer; +import com.fr.report.cell.cellattr.core.group.FunctionGrouper; +import java.util.HashMap; +import java.util.Map; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/6/3 + */ +public class FunctionGrouperContentChange implements ContentChange { + + private final Map> map; + + public FunctionGrouperContentChange() { + map = new HashMap<>(); + map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.FunctionGrouper4WidgetNameContentReplacer); + map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.FunctionGrouper4TableDataNameContentReplacer); + } + + @Override + public String type() { + return FunctionGrouper.class.getName(); + } + + @Override + public Map> changeInfo() { + return map; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/SelectCountContentChange.java b/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/SelectCountContentChange.java new file mode 100644 index 000000000..705bfc51b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/SelectCountContentChange.java @@ -0,0 +1,35 @@ +package com.fr.design.mod.impl.change.formula; + +import com.fr.design.mod.ContentChange; +import com.fr.design.mod.ContentReplacer; +import com.fr.design.mod.bean.ChangeItem; +import com.fr.design.mod.impl.repalce.FormulaReplacer; +import com.fr.report.cell.cellattr.core.group.SelectCount; +import java.util.HashMap; +import java.util.Map; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/6/3 + */ +public class SelectCountContentChange implements ContentChange { + + private final Map> map; + + public SelectCountContentChange() { + map = new HashMap<>(); + map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.SelectCount4WidgetNameContentReplacer); + map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.SelectCount4TableDataNameContentReplacer); + } + + @Override + public String type() { + return SelectCount.class.getName(); + } + + @Override + public Map> changeInfo() { + return map; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/WidgetTitleContentChange.java b/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/WidgetTitleContentChange.java new file mode 100644 index 000000000..f4d8ff764 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mod/impl/change/formula/WidgetTitleContentChange.java @@ -0,0 +1,35 @@ +package com.fr.design.mod.impl.change.formula; + +import com.fr.design.mod.ContentChange; +import com.fr.design.mod.ContentReplacer; +import com.fr.design.mod.bean.ChangeItem; +import com.fr.design.mod.impl.repalce.FormulaReplacer; +import com.fr.form.ui.WidgetTitle; +import java.util.HashMap; +import java.util.Map; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/6/3 + */ +public class WidgetTitleContentChange implements ContentChange { + + private final Map> map; + + public WidgetTitleContentChange() { + map = new HashMap<>(); + map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.WidgetTitle4WidgetNameContentReplacer); + map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.WidgetTitle4TableDataNameContentReplacer); + } + + @Override + public String type() { + return WidgetTitle.class.getName(); + } + + @Override + public Map> changeInfo() { + return map; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumnContentReplacer.java b/designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumn4TableDataNameContentReplacer.java similarity index 55% rename from designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumnContentReplacer.java rename to designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumn4TableDataNameContentReplacer.java index a1c131f6b..548e2f4ee 100644 --- a/designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumnContentReplacer.java +++ b/designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumn4TableDataNameContentReplacer.java @@ -1,5 +1,6 @@ package com.fr.design.mod.impl.repalce; +import com.fr.design.mod.ContentReplaceUtil; import com.fr.design.mod.ContentReplacer; import com.fr.general.ComparatorUtils; import com.fr.report.cell.cellattr.core.group.DSColumn; @@ -9,12 +10,14 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; * @version 10.0 * Created by hades on 2021/6/2 */ -public class DSColumnContentReplacer implements ContentReplacer { +public class DSColumn4TableDataNameContentReplacer implements ContentReplacer { @Override public void replace(DSColumn dsColumn, String oldName, String newName) { if (ComparatorUtils.equals(dsColumn.getDSName(), oldName)) { dsColumn.setDSName(newName); } + dsColumn.setResult(ContentReplaceUtil.replacePureFormula4TableDataName(dsColumn.getResult(), oldName, newName)); + dsColumn.setSortFormula(ContentReplaceUtil.replacePureFormula4TableDataName(dsColumn.getSortFormula(), oldName, newName)); } } diff --git a/designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumn4WidgetNameContentReplacer.java b/designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumn4WidgetNameContentReplacer.java new file mode 100644 index 000000000..ec1418705 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mod/impl/repalce/DSColumn4WidgetNameContentReplacer.java @@ -0,0 +1,19 @@ +package com.fr.design.mod.impl.repalce; + +import com.fr.design.mod.ContentReplaceUtil; +import com.fr.design.mod.ContentReplacer; +import com.fr.report.cell.cellattr.core.group.DSColumn; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/6/3 + */ +public class DSColumn4WidgetNameContentReplacer implements ContentReplacer { + + @Override + public void replace(DSColumn dsColumn, String oldName, String newName) { + dsColumn.setResult(ContentReplaceUtil.replacePureFormula4WidgetName(dsColumn.getResult(), oldName, newName)); + dsColumn.setSortFormula(ContentReplaceUtil.replacePureFormula4WidgetName(dsColumn.getSortFormula(), oldName, newName)); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mod/impl/repalce/FormulaReplacer.java b/designer-base/src/main/java/com/fr/design/mod/impl/repalce/FormulaReplacer.java index b571010a0..7ed57b284 100644 --- a/designer-base/src/main/java/com/fr/design/mod/impl/repalce/FormulaReplacer.java +++ b/designer-base/src/main/java/com/fr/design/mod/impl/repalce/FormulaReplacer.java @@ -7,8 +7,13 @@ import com.fr.data.condition.FormulaCondition; import com.fr.data.impl.FormulaDictionary; import com.fr.design.mod.ContentReplaceUtil; import com.fr.design.mod.ContentReplacer; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.WidgetTitle; import com.fr.report.cell.cellattr.CellExpandAttr; +import com.fr.report.cell.cellattr.CellGUIAttr; import com.fr.report.cell.cellattr.core.RichChar; +import com.fr.report.cell.cellattr.core.group.FunctionGrouper; +import com.fr.report.cell.cellattr.core.group.SelectCount; /** * 持有公式内容对象汇总 @@ -148,4 +153,95 @@ public class FormulaReplacer { } }; + /** + * 公式分组 + * + */ + public static final ContentReplacer FunctionGrouper4TableDataNameContentReplacer = new ContentReplacer() { + @Override + public void replace(FunctionGrouper functionGrouper, String oldName, String newName) { + functionGrouper.setFormulaContent(ContentReplaceUtil.replacePureFormula4TableDataName(functionGrouper.getFormulaContent(), oldName, newName)); + } + }; + + public static final ContentReplacer FunctionGrouper4WidgetNameContentReplacer = new ContentReplacer() { + @Override + public void replace(FunctionGrouper functionGrouper, String oldName, String newName) { + functionGrouper.setFormulaContent(ContentReplaceUtil.replacePureFormula4WidgetName(functionGrouper.getFormulaContent(), oldName, newName)); + } + }; + + /** + * 结果集筛选 + */ + public static final ContentReplacer SelectCount4TableDataNameContentReplacer = new ContentReplacer() { + @Override + public void replace(SelectCount selectCount, String oldName, String newName) { + selectCount.setFormulaCount(ContentReplaceUtil.replacePureFormula4TableDataName(selectCount.getFormulaCount(), oldName, newName)); + } + }; + public static final ContentReplacer SelectCount4WidgetNameContentReplacer = new ContentReplacer() { + @Override + public void replace(SelectCount selectCount, String oldName, String newName) { + selectCount.setFormulaCount(ContentReplaceUtil.replacePureFormula4WidgetName(selectCount.getFormulaCount(), oldName, newName)); + } + }; + + /** + * tab块标题 + */ + public static final ContentReplacer CardSwitchButton4TableDataNameContentReplacer = new ContentReplacer() { + @Override + public void replace(CardSwitchButton cardSwitchButton, String oldName, String newName) { + cardSwitchButton.setText(ContentReplaceUtil.replaceFormulaString4TableDataName(cardSwitchButton.getText(), oldName, newName)); + } + }; + + public static final ContentReplacer CardSwitchButton4WidgetNameContentReplacer = new ContentReplacer() { + @Override + public void replace(CardSwitchButton cardSwitchButton, String oldName, String newName) { + cardSwitchButton.setText(ContentReplaceUtil.replaceFormulaString4WidgetName(cardSwitchButton.getText(), oldName, newName)); + } + }; + + /** + * 悬浮提示 + */ + public static final ContentReplacer CellGUIAttr4TableDataNameContentReplacer = new ContentReplacer() { + @Override + public void replace(CellGUIAttr cellGUIAttr, String oldName, String newName) { + cellGUIAttr.setTooltipText(ContentReplaceUtil.replaceFormulaString4TableDataName(cellGUIAttr.getTooltipText(), oldName, newName)); + } + }; + + public static final ContentReplacer CellGUIAttr4WidgetNameContentReplacer = new ContentReplacer() { + @Override + public void replace(CellGUIAttr cellGUIAttr, String oldName, String newName) { + cellGUIAttr.setTooltipText(ContentReplaceUtil.replaceFormulaString4WidgetName(cellGUIAttr.getTooltipText(), oldName, newName)); + } + }; + + /** + * 图表/报表块等标题 + */ + public static final ContentReplacer WidgetTitle4TableDataNameContentReplacer = new ContentReplacer() { + @Override + public void replace(WidgetTitle widgetTitle, String oldName, String newName) { + if (widgetTitle.getTextObject() instanceof String) { + String content = (String) widgetTitle.getTextObject(); + widgetTitle.setTextObject(ContentReplaceUtil.replaceFormulaString4TableDataName(content, oldName, newName)); + } + } + }; + + public static final ContentReplacer WidgetTitle4WidgetNameContentReplacer = new ContentReplacer() { + @Override + public void replace(WidgetTitle widgetTitle, String oldName, String newName) { + if (widgetTitle.getTextObject() instanceof String) { + String content = (String) widgetTitle.getTextObject(); + widgetTitle.setTextObject(ContentReplaceUtil.replaceFormulaString4WidgetName(content, oldName, newName)); + } + } + }; + }