Browse Source

REPORT-80695 【模板全局级别查找替换二期】适配表格多出来的替换后内容这一列,以及部分校验内容

feature/x
Destiny.Lin 2 years ago
parent
commit
33d82a0db4
  1. 10
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/ComponentType.java
  2. 118
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java
  3. 41
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java
  4. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormulaAction.java
  5. 15
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/JSCheckTag.java
  6. 65
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/JSCheckType.java
  7. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/FrmWidgetType.java

10
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/ComponentType.java

@ -126,7 +126,9 @@ public enum ComponentType implements DealWithInfoValue {
info.updateOldStr(titleLayout.getWidgetName(), findStr);
titleLayout.setWidgetName(ShowValueUtils.replaceAll(titleLayout.getWidgetName(), findStr, replaceStr));
CRBoundsWidget crBoundsWidget = ((CRBoundsWidget) titleLayout.getWidget(0));
crBoundsWidget.getWidget().setWidgetName(ShowValueUtils.replaceAll(crBoundsWidget.getWidget().getWidgetName(), findStr, replaceStr));
String str = crBoundsWidget.getWidget().getWidgetName();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
crBoundsWidget.getWidget().setWidgetName(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -144,7 +146,9 @@ public enum ComponentType implements DealWithInfoValue {
info.updateOldStr(scaleLayout.getWidgetName(), findStr);
scaleLayout.setWidgetName(ShowValueUtils.replaceAll(scaleLayout.getWidgetName(), findStr, replaceStr));
CRBoundsWidget crBoundsWidget = ((CRBoundsWidget) scaleLayout.getWidget(0));
crBoundsWidget.getWidget().setWidgetName(ShowValueUtils.replaceAll(crBoundsWidget.getWidget().getWidgetName(), findStr, replaceStr));
String str = crBoundsWidget.getWidget().getWidgetName();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
crBoundsWidget.getWidget().setWidgetName(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -333,7 +337,9 @@ public enum ComponentType implements DealWithInfoValue {
Object replaceObject = info.getContent().getReplaceObject();
if (replaceObject instanceof Widget) {
Widget widget = ((Widget) replaceObject);
String str = widget.getWidgetName();
info.updateOldStr(widget.getWidgetName(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
widget.setWidgetName(widget.getWidgetName().replaceAll(findStr, replaceStr));
}
}

118
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java

@ -58,12 +58,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) replaceObject).getContent(), findStr);
((Formula) replaceObject).setContent(ShowValueUtils.replaceAll(((Formula) replaceObject).getContent(), findStr, replaceStr));
String str = ((Formula) replaceObject).getContent();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((Formula) replaceObject).setContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof Formula){
if (info.getContent().getReplaceObject() instanceof Formula) {
Formula formula = (Formula) info.getContent().getReplaceObject();
return StringUtils.equals(formula.getContent(), info.getContent().getOldShowStr());
}
@ -88,13 +90,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
Object replaceObject = info.getContent().getReplaceObject();
//更新上一次操作的信息
info.updateOldStr(((FormulaCondition) replaceObject).getFormula(), findStr);
((FormulaCondition) replaceObject).setFormula(ShowValueUtils.replaceAll(((FormulaCondition) replaceObject).getFormula(), findStr, replaceStr));
String str = ((FormulaCondition) replaceObject).getFormula();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((FormulaCondition) replaceObject).setFormula(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof FormulaCondition){
if (info.getContent().getReplaceObject() instanceof FormulaCondition) {
FormulaCondition condition = (FormulaCondition) info.getContent().getReplaceObject();
return StringUtils.equals(condition.getFormula(), info.getContent().getOldShowStr());
}
@ -120,14 +123,15 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
if (((Compare) replaceObject).getValue() instanceof Formula) {
Formula formula = (Formula) ((Compare) replaceObject).getValue();
info.updateOldStr(formula.getContent(), findStr);
formula.setContent(ShowValueUtils.replaceAll(formula.getContent(), findStr, replaceStr));
String str = formula.getContent();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
formula.setContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof Compare){
if (info.getContent().getReplaceObject() instanceof Compare) {
Compare compare = (Compare) info.getContent().getReplaceObject();
return StringUtils.equals(GeneralUtils.objectToString(compare.getValue()), info.getContent().getOldShowStr());
}
@ -151,13 +155,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) ((com.fr.base.core.KV) replaceObject).getValue()).getContent(), findStr);
((Formula) ((com.fr.base.core.KV) replaceObject).getValue()).setContent(ShowValueUtils.replaceAll(((Formula) ((com.fr.base.core.KV) replaceObject).getValue()).getContent(), findStr, replaceStr));
String str = ((Formula) ((com.fr.base.core.KV) replaceObject).getValue()).getContent();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((Formula) ((com.fr.base.core.KV) replaceObject).getValue()).setContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof com.fr.base.core.KV){
if (info.getContent().getReplaceObject() instanceof com.fr.base.core.KV) {
com.fr.base.core.KV kv = (com.fr.base.core.KV) info.getContent().getReplaceObject();
return StringUtils.equals(GeneralUtils.objectToString(kv.getValue()), info.getContent().getOldShowStr());
}
@ -181,12 +186,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) (((CellInsertPolicyAttr) replaceObject).getDefaultInsertValue())).getContent(), findStr);
((Formula) (((CellInsertPolicyAttr) replaceObject).getDefaultInsertValue())).setContent(ShowValueUtils.replaceAll(((Formula) (((CellInsertPolicyAttr) replaceObject).getDefaultInsertValue())).getContent(), findStr, replaceStr));
String str = ((Formula) (((CellInsertPolicyAttr) replaceObject).getDefaultInsertValue())).getContent();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((Formula) (((CellInsertPolicyAttr) replaceObject).getDefaultInsertValue())).setContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof CellInsertPolicyAttr){
if (info.getContent().getReplaceObject() instanceof CellInsertPolicyAttr) {
CellInsertPolicyAttr policyAttr = (CellInsertPolicyAttr) info.getContent().getReplaceObject();
return StringUtils.equals(GeneralUtils.objectToString(policyAttr.getDefaultInsertValue()), info.getContent().getOldShowStr());
}
@ -210,13 +217,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((FormulaPresent) replaceObject).getFormulaContent(), findStr);
((FormulaPresent) replaceObject).setFormulaContent(ShowValueUtils.replaceAll(((FormulaPresent) replaceObject).getFormulaContent(), findStr, replaceStr));
String str = ((FormulaPresent) replaceObject).getFormulaContent();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((FormulaPresent) replaceObject).setFormulaContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof FormulaPresent){
if (info.getContent().getReplaceObject() instanceof FormulaPresent) {
FormulaPresent present = (FormulaPresent) info.getContent().getReplaceObject();
return StringUtils.equals(present.getFormulaContent(), info.getContent().getOldShowStr());
}
@ -240,12 +248,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((SingleJavaScript) replaceObject).getFileName(), findStr);
((SingleJavaScript) replaceObject).setFileName(ShowValueUtils.replaceAll(((SingleJavaScript) replaceObject).getFileName(), findStr, replaceStr));
String str = ((SingleJavaScript) replaceObject).getFileName();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((SingleJavaScript) replaceObject).setFileName(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof SingleJavaScript){
if (info.getContent().getReplaceObject() instanceof SingleJavaScript) {
SingleJavaScript javaScript = (SingleJavaScript) info.getContent().getReplaceObject();
return StringUtils.equals(javaScript.getFileName(), info.getContent().getOldShowStr());
}
@ -269,15 +279,16 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) (((ParameterProvider) replaceObject).getValue())).getContent(), findStr);
((Formula) (((ParameterProvider) replaceObject).getValue())).setContent(ShowValueUtils.replaceAll(((Formula) (((ParameterProvider) replaceObject).getValue())).getContent(), findStr, replaceStr));
String str = ((Formula) (((ParameterProvider) replaceObject).getValue())).getContent();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((Formula) (((ParameterProvider) replaceObject).getValue())).setContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof ParameterProvider){
if (info.getContent().getReplaceObject() instanceof ParameterProvider) {
ParameterProvider provider = (ParameterProvider) info.getContent().getReplaceObject();
if (provider.getValue() instanceof Formula){
if (provider.getValue() instanceof Formula) {
return StringUtils.equals(GeneralUtils.objectToString(provider.getValue()), info.getContent().getOldShowStr());
}
}
@ -301,13 +312,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((FormulaProvider) replaceObject).getContent(), findStr);
((FormulaProvider) replaceObject).setContent(ShowValueUtils.replaceAll(((FormulaProvider) replaceObject).getContent(), findStr, replaceStr));
String str = ((FormulaProvider) replaceObject).getContent();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((FormulaProvider) replaceObject).setContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof FormulaProvider){
if (info.getContent().getReplaceObject() instanceof FormulaProvider) {
FormulaProvider provider = (FormulaProvider) info.getContent().getReplaceObject();
return StringUtils.equals(provider.getContent(), info.getContent().getOldShowStr());
}
@ -331,15 +343,16 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) (((Parameter) replaceObject).getValue())).getContent(), findStr);
((Formula) (((Parameter) replaceObject).getValue())).setContent(ShowValueUtils.replaceAll(((Formula) (((Parameter) replaceObject).getValue())).getContent(), findStr, replaceStr));
String str = ((Formula) (((Parameter) replaceObject).getValue())).getContent();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((Formula) (((Parameter) replaceObject).getValue())).setContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof Parameter){
if (info.getContent().getReplaceObject() instanceof Parameter) {
Parameter parameter = (Parameter) info.getContent().getReplaceObject();
if (parameter.getValue() instanceof Formula){
if (parameter.getValue() instanceof Formula) {
return StringUtils.equals(((Formula) parameter.getValue()).getContent(), info.getContent().getOldShowStr());
}
}
@ -363,13 +376,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((DSColumn) replaceObject).getResult(), findStr);
((DSColumn) replaceObject).setResult(ShowValueUtils.replaceAll(((DSColumn) replaceObject).getResult(), findStr, replaceStr));
String str = ((DSColumn) replaceObject).getResult();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((DSColumn) replaceObject).setResult(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof DSColumn){
if (info.getContent().getReplaceObject() instanceof DSColumn) {
DSColumn column = (DSColumn) info.getContent().getReplaceObject();
return StringUtils.equals(column.getResult(), info.getContent().getOldShowStr());
}
@ -393,13 +407,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((BaseFormula) replaceObject).getContent(), findStr);
((BaseFormula) replaceObject).setContent(ShowValueUtils.replaceAll(((BaseFormula) replaceObject).getContent(), findStr, replaceStr));
String str = ((BaseFormula) replaceObject).getContent();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((BaseFormula) replaceObject).setContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof BaseFormula){
if (info.getContent().getReplaceObject() instanceof BaseFormula) {
BaseFormula formula = (BaseFormula) info.getContent().getReplaceObject();
return StringUtils.equals(formula.getContent(), info.getContent().getOldShowStr());
}
@ -423,16 +438,17 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr(((Formula) ((StoreProcedureParameter) replaceObject).getValue()).getContent(), findStr);
((Formula) ((StoreProcedureParameter) replaceObject).getValue()).setContent(ShowValueUtils.replaceAll(((Formula) ((StoreProcedureParameter) replaceObject).getValue()).getContent(), findStr, replaceStr));
String str = ((Formula) ((StoreProcedureParameter) replaceObject).getValue()).getContent();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((Formula) ((StoreProcedureParameter) replaceObject).getValue()).setContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof StoreProcedureParameter){
if (info.getContent().getReplaceObject() instanceof StoreProcedureParameter) {
StoreProcedureParameter procedureParameter = (StoreProcedureParameter) info.getContent().getReplaceObject();
if (procedureParameter.getValue() instanceof Formula){
if (procedureParameter.getValue() instanceof Formula) {
return StringUtils.equals(GeneralUtils.objectToString(procedureParameter.getValue()), info.getContent().getOldShowStr());
}
}
@ -457,13 +473,15 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
WorkBook workBook = (WorkBook) HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget();
WatermarkAttr watermarkAttr = (WatermarkAttr) info.getContent().getReplaceObject();
info.updateOldStr(watermarkAttr.getText(), findStr);
watermarkAttr.setText(ShowValueUtils.replaceAll(watermarkAttr.getText(), findStr, replaceStr));
String str = watermarkAttr.getText();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
watermarkAttr.setText(ShowValueUtils.replaceAll(str, findStr, replaceStr));
workBook.addAttrMark(watermarkAttr);
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof WatermarkAttr){
if (info.getContent().getReplaceObject() instanceof WatermarkAttr) {
WatermarkAttr watermarkAttr = ((WatermarkAttr) info.getContent().getReplaceObject());
return StringUtils.equals(watermarkAttr.getText(), info.getContent().getOldShowStr());
}
@ -473,11 +491,11 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
/**
* 存储字符串类型需要特殊处理
*/
STRING("String"){
STRING("String") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(o[0]))){
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(o[0]))) {
map.put("content", GeneralUtils.objectToString(o[0]));
}
return map;
@ -486,7 +504,7 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
@Override
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
FormulaTag formulaTag = FormulaTag.match(info.getContent().getTag());
if (formulaTag != null){
if (formulaTag != null) {
info.updateOldStr(GeneralUtils.objectToString(info.getContent().getReplaceObject()), findStr);
formulaTag.setValue(info, findStr, replaceStr, operatorArray);
}
@ -500,7 +518,7 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
/**
* 排序
*/
FORMULA_SORT_EXPRESSION("FormulaSortExpression"){
FORMULA_SORT_EXPRESSION("FormulaSortExpression") {
@Override
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
@ -514,19 +532,20 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
Object replaceObject = info.getContent().getReplaceObject();
info.updateOldStr((((FormulaSortExpression) replaceObject).getFormula()), findStr);
((FormulaSortExpression) replaceObject).setFormula(ShowValueUtils.replaceAll((((FormulaSortExpression) replaceObject).getFormula()), findStr, replaceStr));
String str = (((FormulaSortExpression) replaceObject).getFormula());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((FormulaSortExpression) replaceObject).setFormula(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
public boolean check(Info info) {
if (info.getContent().getReplaceObject() instanceof FormulaSortExpression){
if (info.getContent().getReplaceObject() instanceof FormulaSortExpression) {
FormulaSortExpression sortExpression = (FormulaSortExpression) info.getContent().getReplaceObject();
return StringUtils.equals(sortExpression.getFormula(), info.getContent().getOldShowStr());
}
return false;
}
}
;
};
String name;
@ -554,6 +573,7 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
/**
* 校验内容
*
* @param info
* @return
*/

41
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java

@ -33,7 +33,9 @@ public enum FormulaTag implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setLongitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getLongitude()), findStr, replaceStr));
String str = GeneralUtils.objectToString(definition.getLongitude());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
definition.setLongitude(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -45,7 +47,9 @@ public enum FormulaTag implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setLatitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getLatitude()), findStr, replaceStr));
String str = GeneralUtils.objectToString(definition.getLatitude());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
definition.setLatitude(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -57,7 +61,9 @@ public enum FormulaTag implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setCategoryName(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getCategoryName()), findStr, replaceStr));
String str = GeneralUtils.objectToString(definition.getCategoryName());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
definition.setCategoryName(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -69,7 +75,9 @@ public enum FormulaTag implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setEndLongitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getEndLongitude()), findStr, replaceStr));
String str = GeneralUtils.objectToString(definition.getEndLongitude());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
definition.setEndLongitude(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -81,7 +89,9 @@ public enum FormulaTag implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setEndLatitude(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getEndLatitude()), findStr, replaceStr));
String str = GeneralUtils.objectToString(definition.getEndLatitude());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
definition.setEndLatitude(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -93,7 +103,9 @@ public enum FormulaTag implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VanMapReportDefinition) {
VanMapReportDefinition definition = (VanMapReportDefinition) info.getContent().getHoldObject();
definition.setEndAreaName(ShowValueUtils.replaceAll(GeneralUtils.objectToString(definition.getEndAreaName()), findStr, replaceStr));
String str = GeneralUtils.objectToString(definition.getEndAreaName());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
definition.setEndAreaName(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -105,7 +117,9 @@ public enum FormulaTag implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof VerifyItem) {
VerifyItem item = (VerifyItem) info.getContent().getHoldObject();
item.setMessage(ShowValueUtils.replaceAll(item.getMessage(), findStr, replaceStr));
String str = item.getMessage();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
item.setMessage(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -119,6 +133,7 @@ public enum FormulaTag implements DealWithInfoValue {
WorkBook workBook = (WorkBook) info.getContent().getHoldObject();
int sheetId = Integer.parseInt(info.getContent().getSheetID());
String name = workBook.getReportName(sheetId);
ShowValueUtils.updateAfterReplaceStr(info, name, findStr, replaceStr);
workBook.setReportName(sheetId, ShowValueUtils.replaceAll(name, findStr, replaceStr));
}
}
@ -131,7 +146,9 @@ public enum FormulaTag implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof CellGUIAttr) {
CellGUIAttr attr = (CellGUIAttr) info.getContent().getHoldObject();
attr.setTooltipText(ShowValueUtils.replaceAll(attr.getTooltipText(), findStr, replaceStr));
String str = attr.getTooltipText();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
attr.setTooltipText(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -140,7 +157,9 @@ public enum FormulaTag implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof FormulaDictionary) {
FormulaDictionary dictionary = (FormulaDictionary) info.getContent().getHoldObject();
dictionary.setExcuteFormula(ShowValueUtils.replaceAll(dictionary.getExcuteFormula(), findStr, replaceStr));
String str = dictionary.getExcuteFormula();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
dictionary.setExcuteFormula(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
},
@ -149,7 +168,9 @@ public enum FormulaTag implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
if (info.getContent().getHoldObject() instanceof FormulaDictionary) {
FormulaDictionary dictionary = (FormulaDictionary) info.getContent().getHoldObject();
dictionary.setProduceFormula(ShowValueUtils.replaceAll(dictionary.getProduceFormula(), findStr, replaceStr));
String str = dictionary.getProduceFormula();
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
dictionary.setProduceFormula(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
};

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

@ -149,8 +149,8 @@ public class SearchTemplateFormulaAction implements SearchTemplateFormula {
@Override
public void searchTemplateWaterMarkFormula(JTemplate jTemplate, List<FormulaInfo> formulaInfos, ITContent content) {
WatermarkAttr watermarkAttr = ReportUtils.getWatermarkAttrFromTemplateAndGlobal((AttrMark) jTemplate.getTarget());
if (watermarkAttr != null) {
WatermarkAttr watermarkAttr = ReportUtils.getWatermarkAttrFromTemplate((AttrMark) jTemplate.getTarget());
if (watermarkAttr != null && watermarkAttr.isValid()) {
ITContent waterMarkContent = ITContent.copy(content);
waterMarkContent.addOtherPos(Toolkit.i18nText("Fine-Design_Form_WaterMark"));
waterMarkContent.setReplaceObject(watermarkAttr);

15
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/JSCheckTag.java

@ -0,0 +1,15 @@
package com.fr.design.actions.replace.action.content.js;
/**
* 检查JS的标签
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-26
*/
public class JSCheckTag {
/**
* 单元格-超级链接
*/
public static final int CELL_HYPERLINK = 0;
}

65
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/JSCheckType.java

@ -0,0 +1,65 @@
package com.fr.design.actions.replace.action.content.js;
import com.fr.design.actions.replace.info.Info;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.Elem;
import org.jetbrains.annotations.Nullable;
/**
* 检查JS是否修改过
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-26
*/
public enum JSCheckType {
/**
* 单元格-超级链接
*/
CELL_HYPERLINK(JSCheckTag.CELL_HYPERLINK) {
@Override
public boolean check(Info info) {
Elem elem = (Elem) info.getContent().getHoldObject();
NameJavaScriptGroup group = elem.getNameHyperlinkGroup();
int len = group.size();
if (len == 0) {
return false;
}
NameJavaScript javaScript = (NameJavaScript) info.getContent().getReplaceObject();
for (int i = 0; i < len; i++) {
if (group.getNameHyperlink(i).equals(javaScript)) {
return true;
}
}
return false;
}
};
int index;
JSCheckType(int index) {
this.index = index;
}
/**
* 匹配
*
* @param index
* @return
*/
@Nullable
public static JSCheckType match(int index) {
JSCheckType[] values = JSCheckType.values();
for (JSCheckType value : values) {
if (value.index == index) {
return value;
}
}
return null;
}
public abstract boolean check(Info info);
}

1
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/FrmWidgetType.java

@ -167,6 +167,7 @@ public enum FrmWidgetType implements SearchFrmWidget, DealWithInfoValue {
if (((WidgetInfo) info).isWaterMark()) {
WaterMark waterMark = (WaterMark) widget;
info.updateOldStr(waterMark.getWaterMark(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, waterMark.getWaterMark(), findStr, replaceStr);
waterMark.setWaterMark(ShowValueUtils.replaceAll(waterMark.getWaterMark(), findStr, replaceStr));
} else {
info.updateOldStr(widget.getWidgetName(), findStr);

Loading…
Cancel
Save