Browse Source

REPORT-53169 【智能联动】组件拖入时,公式多个使用的地方不会被替换

feature/10.0
hades 3 years ago
parent
commit
6048b6569b
  1. 12
      designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java
  2. 62
      designer-base/src/main/java/com/fr/design/mod/ContentReplaceUtil.java
  3. 14
      designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java
  4. 37
      designer-base/src/main/java/com/fr/design/mod/impl/change/formula/CellExpandAttrContentChange.java
  5. 37
      designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FormulaConditionContentChange.java
  6. 9
      designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FormulaContentChange.java
  7. 37
      designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FormulaDictionaryContentChange.java
  8. 38
      designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FormulaHFElementContentChange.java
  9. 38
      designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FormulaPresentContentChange.java
  10. 37
      designer-base/src/main/java/com/fr/design/mod/impl/change/formula/RichCharContentChange.java
  11. 22
      designer-base/src/main/java/com/fr/design/mod/impl/repalce/Formula4TableDataNameContentReplacer.java
  12. 21
      designer-base/src/main/java/com/fr/design/mod/impl/repalce/Formula4WidgetNameContentReplacer.java
  13. 151
      designer-base/src/main/java/com/fr/design/mod/impl/repalce/FormulaReplacer.java

12
designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java

@ -1,14 +1,20 @@
package com.fr.design.mod;
import com.fr.base.Formula;
import com.fr.base.headerfooter.FormulaHFElement;
import com.fr.base.present.FormulaPresent;
import com.fr.chart.web.ChartHyperRelateCellLink;
import com.fr.chart.web.ChartHyperRelateFloatLink;
import com.fr.data.SimpleDSColumn;
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.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.core.RichChar;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.stable.Filter;
import java.util.HashSet;
@ -48,6 +54,12 @@ public class ContentObjectManager {
set.add(SimpleDSColumn.class.getName());
set.add(DSColumn.class.getName());
set.add(FormHyperlink.class.getName());
set.add(CellExpandAttr.class.getName());
set.add(FormulaCondition.class.getName());
set.add(FormulaDictionary.class.getName());
set.add(FormulaHFElement.class.getName());
set.add(FormulaPresent.class.getName());
set.add(RichChar.class.getName());
}
public void searchObject(Object ob) {

62
designer-base/src/main/java/com/fr/design/mod/ContentReplaceUtil.java

@ -1,5 +1,7 @@
package com.fr.design.mod;
import com.fr.parser.FRFormulaTransformer;
import com.fr.stable.StringUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -12,6 +14,10 @@ public class ContentReplaceUtil {
public static final String EQ_STRING = "=";
public static final String LEFT_BRACKET = "${";
public static final String RIGHT_BRACKET = "}";
public static String replaceContent(String content, String oldName, String newName) {
String oldNameUpper = oldName.toUpperCase();
Matcher m = Pattern.compile(oldName + "|" + oldNameUpper).matcher(content);
@ -37,4 +43,60 @@ public class ContentReplaceUtil {
return "\"" + str + "\"";
}
public static String getFormulaPureContent(String content) {
if (content.startsWith(EQ_STRING)) {
return content.substring(1);
} else {
return content;
}
}
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 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 content;
}
public static String getRichCharFormulaPureContent(String content) {
if (content.startsWith(LEFT_BRACKET)) {
return content.substring(LEFT_BRACKET.length() + 1, content.length() - 1);
} else {
return content;
}
}
public static String replaceRichCharFormulaContent4TableDataName(String content, String oldName, String newName) {
if (StringUtils.isNotEmpty(content)) {
content = getRichCharFormulaPureContent(content);
FRFormulaTransformer frFormulaTransformer = new FRFormulaTransformer();
frFormulaTransformer.addRenamedDataset(oldName, newName);
return LEFT_BRACKET + EQ_STRING + frFormulaTransformer.transform(content) + RIGHT_BRACKET;
}
return content;
}
public static String replaceRichCharFormulaContent4WidgetName(String content, String oldName, String newName) {
if (StringUtils.isNotEmpty(content)) {
content = getRichCharFormulaPureContent(content);
FRFormulaTransformer frFormulaTransformer = new FRFormulaTransformer();
frFormulaTransformer.addRenamedWidget(oldName, newName);
return LEFT_BRACKET + EQ_STRING + frFormulaTransformer.transform(content) + RIGHT_BRACKET;
}
return content;
}
}

14
designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java

@ -8,11 +8,17 @@ 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.FormulaContentChange;
import com.fr.design.mod.impl.change.formula.CellExpandAttrContentChange;
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;
import com.fr.design.mod.impl.change.NameTableDataContentChange;
import com.fr.design.mod.impl.change.SimpleDSColumnContentChange;
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.RichCharContentChange;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
@ -81,6 +87,12 @@ public class ContentReplacerCenter {
contentChangeList.add(new SimpleDSColumnContentChange());
contentChangeList.add(new DSColumnContentChange());
contentChangeList.add(new FormHyperlinkContentChange());
contentChangeList.add(new CellExpandAttrContentChange());
contentChangeList.add(new FormulaConditionContentChange());
contentChangeList.add(new FormulaDictionaryContentChange());
contentChangeList.add(new FormulaHFElementContentChange());
contentChangeList.add(new FormulaPresentContentChange());
contentChangeList.add(new RichCharContentChange());
}
private void onRename(List<ContentChangeItem> contentChangeItemList, List<ContentChange> contentChangeList) {

37
designer-base/src/main/java/com/fr/design/mod/impl/change/formula/CellExpandAttrContentChange.java

@ -0,0 +1,37 @@
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.CellExpandAttr;
import java.util.HashMap;
import java.util.Map;
/**
* 扩展后排序公式
*
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class CellExpandAttrContentChange implements ContentChange<CellExpandAttr> {
private final Map<ChangeItem, ContentReplacer<CellExpandAttr>> map;
public CellExpandAttrContentChange() {
map = new HashMap<>();
map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.CellExpandAttr4WidgetNameContentReplacer);
map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.CellExpandAttr4TableDataNameContentReplacer);
}
@Override
public String type() {
return CellExpandAttr.class.getName();
}
@Override
public Map<ChangeItem, ContentReplacer<CellExpandAttr>> changeInfo() {
return map;
}
}

37
designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FormulaConditionContentChange.java

@ -0,0 +1,37 @@
package com.fr.design.mod.impl.change.formula;
import com.fr.data.condition.FormulaCondition;
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 java.util.HashMap;
import java.util.Map;
/**
* 公式条件
*
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class FormulaConditionContentChange implements ContentChange<FormulaCondition> {
private final Map<ChangeItem, ContentReplacer<FormulaCondition>> map;
public FormulaConditionContentChange() {
map = new HashMap<>();
map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.FormulaCondition4WidgetNameContentReplacer);
map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.FormulaCondition4TableDataNameContentReplacer);
}
@Override
public String type() {
return FormulaCondition.class.getName();
}
@Override
public Map<ChangeItem, ContentReplacer<FormulaCondition>> changeInfo() {
return map;
}
}

9
designer-base/src/main/java/com/fr/design/mod/impl/change/FormulaContentChange.java → designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FormulaContentChange.java

@ -1,11 +1,10 @@
package com.fr.design.mod.impl.change;
package com.fr.design.mod.impl.change.formula;
import com.fr.base.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.Formula4TableDataNameContentReplacer;
import com.fr.design.mod.impl.repalce.Formula4WidgetNameContentReplacer;
import com.fr.design.mod.impl.repalce.FormulaReplacer;
import java.util.HashMap;
import java.util.Map;
@ -20,8 +19,8 @@ public class FormulaContentChange implements ContentChange<Formula> {
public FormulaContentChange() {
map = new HashMap<>();
map.put(ChangeItem.WIDGET_NAME, new Formula4WidgetNameContentReplacer());
map.put(ChangeItem.TABLE_DATA_NAME, new Formula4TableDataNameContentReplacer());
map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.Formula4WidgetNameContentReplacer);
map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.Formula4TableDataNameContentReplacer);
}
@Override

37
designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FormulaDictionaryContentChange.java

@ -0,0 +1,37 @@
package com.fr.design.mod.impl.change.formula;
import com.fr.data.impl.FormulaDictionary;
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 java.util.HashMap;
import java.util.Map;
/**
* 数据字典公式
*
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class FormulaDictionaryContentChange implements ContentChange<FormulaDictionary> {
private final Map<ChangeItem, ContentReplacer<FormulaDictionary>> map;
public FormulaDictionaryContentChange() {
map = new HashMap<>();
map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.FormulaDictionary4WidgetNameContentReplacer);
map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.FormulaDictionary4TableDataNameContentReplacer);
}
@Override
public String type() {
return FormulaDictionary.class.getName();
}
@Override
public Map<ChangeItem, ContentReplacer<FormulaDictionary>> changeInfo() {
return map;
}
}

38
designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FormulaHFElementContentChange.java

@ -0,0 +1,38 @@
package com.fr.design.mod.impl.change.formula;
import com.fr.base.headerfooter.FormulaHFElement;
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 java.util.HashMap;
import java.util.Map;
/**
* 页面/页脚公式
*
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class FormulaHFElementContentChange implements ContentChange<FormulaHFElement> {
private final Map<ChangeItem, ContentReplacer<FormulaHFElement>> map;
public FormulaHFElementContentChange() {
map = new HashMap<>();
map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.FormulaHFElement4WidgetNameContentReplacer);
map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.FormulaHFElement4TableDataNameContentReplacer);
}
@Override
public String type() {
return FormulaHFElement.class.getName();
}
@Override
public Map<ChangeItem, ContentReplacer<FormulaHFElement>> changeInfo() {
return map;
}
}

38
designer-base/src/main/java/com/fr/design/mod/impl/change/formula/FormulaPresentContentChange.java

@ -0,0 +1,38 @@
package com.fr.design.mod.impl.change.formula;
import com.fr.base.present.FormulaPresent;
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 java.util.HashMap;
import java.util.Map;
/**
* 公式形态
*
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class FormulaPresentContentChange implements ContentChange<FormulaPresent> {
private final Map<ChangeItem, ContentReplacer<FormulaPresent>> map;
public FormulaPresentContentChange() {
map = new HashMap<>();
map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.FormulaPresent4WidgetNameContentReplacer);
map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.FormulaPresent4TableDataNameContentReplacer);
}
@Override
public String type() {
return FormulaPresent.class.getName();
}
@Override
public Map<ChangeItem, ContentReplacer<FormulaPresent>> changeInfo() {
return map;
}
}

37
designer-base/src/main/java/com/fr/design/mod/impl/change/formula/RichCharContentChange.java

@ -0,0 +1,37 @@
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.RichChar;
import java.util.HashMap;
import java.util.Map;
/**
* 富文本
*
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class RichCharContentChange implements ContentChange<RichChar> {
private final Map<ChangeItem, ContentReplacer<RichChar>> map;
public RichCharContentChange() {
map = new HashMap<>();
map.put(ChangeItem.WIDGET_NAME, FormulaReplacer.RichChar4WidgetNameContentReplacer);
map.put(ChangeItem.TABLE_DATA_NAME, FormulaReplacer.RichChar4TableDataNameContentReplacer);
}
@Override
public String type() {
return RichChar.class.getName();
}
@Override
public Map<ChangeItem, ContentReplacer<RichChar>> changeInfo() {
return map;
}
}

22
designer-base/src/main/java/com/fr/design/mod/impl/repalce/Formula4TableDataNameContentReplacer.java

@ -1,22 +0,0 @@
package com.fr.design.mod.impl.repalce;
import com.fr.base.Formula;
import com.fr.design.mod.ContentReplaceUtil;
import com.fr.design.mod.ContentReplacer;
import com.fr.parser.FRFormulaTransformer;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/5/28
*/
public class Formula4TableDataNameContentReplacer implements ContentReplacer<Formula> {
@Override
public void replace(Formula formula, String oldName, String newName) {
FRFormulaTransformer frFormulaTransformer = new FRFormulaTransformer();
frFormulaTransformer.addRenamedDataset(oldName, newName);
formula.setContent(ContentReplaceUtil.EQ_STRING + frFormulaTransformer.transform(formula.getPureContent()));
}
}

21
designer-base/src/main/java/com/fr/design/mod/impl/repalce/Formula4WidgetNameContentReplacer.java

@ -1,21 +0,0 @@
package com.fr.design.mod.impl.repalce;
import com.fr.base.Formula;
import com.fr.design.mod.ContentReplaceUtil;
import com.fr.design.mod.ContentReplacer;
import com.fr.parser.FRFormulaTransformer;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/5/28
*/
public class Formula4WidgetNameContentReplacer implements ContentReplacer<Formula> {
@Override
public void replace(Formula formula, String oldName, String newName) {
FRFormulaTransformer frFormulaTransformer = new FRFormulaTransformer();
frFormulaTransformer.addRenamedWidget(oldName, newName);
formula.setContent(ContentReplaceUtil.EQ_STRING + frFormulaTransformer.transform(formula.getPureContent()));
}
}

151
designer-base/src/main/java/com/fr/design/mod/impl/repalce/FormulaReplacer.java

@ -0,0 +1,151 @@
package com.fr.design.mod.impl.repalce;
import com.fr.base.Formula;
import com.fr.base.headerfooter.FormulaHFElement;
import com.fr.base.present.FormulaPresent;
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.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.RichChar;
/**
* 持有公式内容对象汇总
*
* @author hades
* @version 10.0
* Created by hades on 2021/6/2
*/
public class FormulaReplacer {
/**
* 扩展后排序公式
*/
public static final ContentReplacer<CellExpandAttr> CellExpandAttr4TableDataNameContentReplacer = new ContentReplacer<CellExpandAttr>() {
@Override
public void replace(CellExpandAttr cellExpandAttr, String oldName, String newName) {
cellExpandAttr.setSortFormula(ContentReplaceUtil.replaceFormulaContent4TableDataName(cellExpandAttr.getSortFormula(), oldName, newName));
}
};
public static final ContentReplacer<CellExpandAttr> CellExpandAttr4WidgetNameContentReplacer = new ContentReplacer<CellExpandAttr>() {
@Override
public void replace(CellExpandAttr cellExpandAttr, String oldName, String newName) {
cellExpandAttr.setSortFormula(ContentReplaceUtil.replaceFormulaContent4WidgetName(cellExpandAttr.getSortFormula(), oldName, newName));
}
};
/**
* 典型单元格公式
*/
public static final ContentReplacer<Formula> Formula4TableDataNameContentReplacer = new ContentReplacer<Formula>() {
@Override
public void replace(Formula formula, String oldName, String newName) {
formula.setContent(ContentReplaceUtil.replaceFormulaContent4TableDataName(formula.getPureContent(), oldName, newName));
}
};
public static final ContentReplacer<Formula> Formula4WidgetNameContentReplacer = new ContentReplacer<Formula>() {
@Override
public void replace(Formula formula, String oldName, String newName) {
formula.setContent(ContentReplaceUtil.replaceFormulaContent4WidgetName(formula.getPureContent(), oldName, newName));
}
};
/**
* 公式条件
*/
public static final ContentReplacer<FormulaCondition> FormulaCondition4TableDataNameContentReplacer = new ContentReplacer<FormulaCondition>() {
@Override
public void replace(FormulaCondition formulaCondition, String oldName, String newName) {
formulaCondition.setFormula(ContentReplaceUtil.replaceFormulaContent4TableDataName(formulaCondition.getFormula(), oldName, newName));
}
};
public static final ContentReplacer<FormulaCondition> FormulaCondition4WidgetNameContentReplacer = new ContentReplacer<FormulaCondition>() {
@Override
public void replace(FormulaCondition formulaCondition, String oldName, String newName) {
formulaCondition.setFormula(ContentReplaceUtil.replaceFormulaContent4WidgetName(formulaCondition.getFormula(), oldName, newName));
}
};
/**
* 数据字典公式
*/
public static final ContentReplacer<FormulaDictionary> FormulaDictionary4TableDataNameContentReplacer = new ContentReplacer<FormulaDictionary>() {
@Override
public void replace(FormulaDictionary formulaDictionary, String oldName, String newName) {
formulaDictionary.setExcuteFormula(ContentReplaceUtil.replaceFormulaContent4TableDataName(formulaDictionary.getExcuteFormula(), oldName, newName));
formulaDictionary.setProduceFormula(ContentReplaceUtil.replaceFormulaContent4TableDataName(formulaDictionary.getProduceFormula(), oldName, newName));
}
};
public static final ContentReplacer<FormulaDictionary> FormulaDictionary4WidgetNameContentReplacer = new ContentReplacer<FormulaDictionary>() {
@Override
public void replace(FormulaDictionary formulaDictionary, String oldName, String newName) {
formulaDictionary.setExcuteFormula(ContentReplaceUtil.replaceFormulaContent4WidgetName(formulaDictionary.getExcuteFormula(), oldName, newName));
formulaDictionary.setProduceFormula(ContentReplaceUtil.replaceFormulaContent4WidgetName(formulaDictionary.getProduceFormula(), oldName, newName));
}
};
/**
* 页面/页脚公式
*/
public static final ContentReplacer<FormulaHFElement> FormulaHFElement4TableDataNameContentReplacer = new ContentReplacer<FormulaHFElement>() {
@Override
public void replace(FormulaHFElement formulaHFElement, String oldName, String newName) {
formulaHFElement.setFormulaContent(ContentReplaceUtil.replaceFormulaContent4TableDataName(formulaHFElement.getFormulaContent(), oldName, newName));
}
};
public static final ContentReplacer<FormulaHFElement> FormulaHFElement4WidgetNameContentReplacer = new ContentReplacer<FormulaHFElement>() {
@Override
public void replace(FormulaHFElement formulaHFElement, String oldName, String newName) {
formulaHFElement.setFormulaContent(ContentReplaceUtil.replaceFormulaContent4WidgetName(formulaHFElement.getFormulaContent(), oldName, newName));
}
};
/**
* 公式形态
*/
public static final ContentReplacer<FormulaPresent> FormulaPresent4TableDataNameContentReplacer = new ContentReplacer<FormulaPresent>() {
@Override
public void replace(FormulaPresent formulaPresent, String oldName, String newName) {
formulaPresent.setFormulaContent(ContentReplaceUtil.replaceFormulaContent4TableDataName(formulaPresent.getFormulaContent(), oldName, newName));
}
};
public static final ContentReplacer<FormulaPresent> FormulaPresent4WidgetNameContentReplacer = new ContentReplacer<FormulaPresent>() {
@Override
public void replace(FormulaPresent formulaPresent, String oldName, String newName) {
formulaPresent.setFormulaContent(ContentReplaceUtil.replaceFormulaContent4WidgetName(formulaPresent.getFormulaContent(), oldName, newName));
}
};
/**
* 富文本公式
*/
public static final ContentReplacer<RichChar> RichChar4TableDataNameContentReplacer = new ContentReplacer<RichChar>() {
@Override
public void replace(RichChar richChar, String oldName, String newName) {
if (richChar.isFormula()) {
richChar.setText(ContentReplaceUtil.replaceRichCharFormulaContent4TableDataName(richChar.getText(), oldName, newName));
}
}
};
public static final ContentReplacer<RichChar> RichChar4WidgetNameContentReplacer = new ContentReplacer<RichChar>() {
@Override
public void replace(RichChar richChar, String oldName, String newName) {
if (richChar.isFormula()) {
richChar.setText(ContentReplaceUtil.replaceRichCharFormulaContent4WidgetName(richChar.getText(), oldName, newName));
}
}
};
}
Loading…
Cancel
Save