Browse Source
* commit '85ed9da973da267bac0a387a356706c77d4ff6ea': REPORT-53211 && REPORT-53208 && REPORT-53209 && REPORT-53207 几个使用公式的场景未联动修改 REPORT-52928 快捷配置使用埋点的数据没保存 REPORT-53169 【智能联动】组件拖入时,公式多个使用的地方不会被替换 REPORT-52987 修复kerberos认证下暴露的throwable和驱动加载优先级问题 REPORT-53163 图表超链联动 REPORT-53159 【智能联动】组件拖入时,tab中的js引用多个组件,只会替换一次feature/big-screen
superman
3 years ago
26 changed files with 1003 additions and 55 deletions
@ -0,0 +1,34 @@
|
||||
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.FormHyperlinkContentReplacer; |
||||
import com.fr.form.main.FormHyperlink; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/6/2 |
||||
*/ |
||||
public class FormHyperlinkContentChange implements ContentChange<FormHyperlink> { |
||||
|
||||
private final Map<ChangeItem, ContentReplacer<FormHyperlink>> map; |
||||
|
||||
public FormHyperlinkContentChange() { |
||||
map = new HashMap<>(); |
||||
map.put(ChangeItem.WIDGET_NAME, new FormHyperlinkContentReplacer()); |
||||
} |
||||
|
||||
@Override |
||||
public String type() { |
||||
return FormHyperlink.class.getName(); |
||||
} |
||||
|
||||
@Override |
||||
public Map<ChangeItem, ContentReplacer<FormHyperlink>> changeInfo() { |
||||
return map; |
||||
} |
||||
} |
@ -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<CardSwitchButton> { |
||||
|
||||
|
||||
private final Map<ChangeItem, ContentReplacer<CardSwitchButton>> 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<ChangeItem, ContentReplacer<CardSwitchButton>> changeInfo() { |
||||
return map; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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<CellGUIAttr> { |
||||
|
||||
private Map<ChangeItem, ContentReplacer<CellGUIAttr>> 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<ChangeItem, ContentReplacer<CellGUIAttr>> changeInfo() { |
||||
return map; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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<FunctionGrouper> { |
||||
|
||||
private final Map<ChangeItem, ContentReplacer<FunctionGrouper>> 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<ChangeItem, ContentReplacer<FunctionGrouper>> changeInfo() { |
||||
return map; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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<SelectCount> { |
||||
|
||||
private final Map<ChangeItem, ContentReplacer<SelectCount>> 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<ChangeItem, ContentReplacer<SelectCount>> changeInfo() { |
||||
return map; |
||||
} |
||||
} |
@ -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<WidgetTitle> { |
||||
|
||||
private final Map<ChangeItem, ContentReplacer<WidgetTitle>> 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<ChangeItem, ContentReplacer<WidgetTitle>> changeInfo() { |
||||
return map; |
||||
} |
||||
} |
@ -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<DSColumn> { |
||||
|
||||
@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)); |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.design.mod.impl.repalce; |
||||
|
||||
import com.fr.design.mod.ContentReplacer; |
||||
import com.fr.form.main.FormHyperlink; |
||||
import com.fr.general.ComparatorUtils; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/6/2 |
||||
*/ |
||||
public class FormHyperlinkContentReplacer implements ContentReplacer<FormHyperlink> { |
||||
|
||||
@Override |
||||
public void replace(FormHyperlink formHyperlink, String oldName, String newName) { |
||||
if (ComparatorUtils.equals(formHyperlink.getRelateEditorName(), oldName)) { |
||||
formHyperlink.setRelateEditorName(newName); |
||||
} |
||||
} |
||||
} |
@ -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())); |
||||
} |
||||
|
||||
} |
@ -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())); |
||||
} |
||||
} |
@ -0,0 +1,247 @@
|
||||
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.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; |
||||
|
||||
/** |
||||
* 持有公式内容对象汇总 |
||||
* |
||||
* @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)); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* 公式分组 |
||||
* |
||||
*/ |
||||
public static final ContentReplacer<FunctionGrouper> FunctionGrouper4TableDataNameContentReplacer = new ContentReplacer<FunctionGrouper>() { |
||||
@Override |
||||
public void replace(FunctionGrouper functionGrouper, String oldName, String newName) { |
||||
functionGrouper.setFormulaContent(ContentReplaceUtil.replacePureFormula4TableDataName(functionGrouper.getFormulaContent(), oldName, newName)); |
||||
} |
||||
}; |
||||
|
||||
public static final ContentReplacer<FunctionGrouper> FunctionGrouper4WidgetNameContentReplacer = new ContentReplacer<FunctionGrouper>() { |
||||
@Override |
||||
public void replace(FunctionGrouper functionGrouper, String oldName, String newName) { |
||||
functionGrouper.setFormulaContent(ContentReplaceUtil.replacePureFormula4WidgetName(functionGrouper.getFormulaContent(), oldName, newName)); |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* 结果集筛选 |
||||
*/ |
||||
public static final ContentReplacer<SelectCount> SelectCount4TableDataNameContentReplacer = new ContentReplacer<SelectCount>() { |
||||
@Override |
||||
public void replace(SelectCount selectCount, String oldName, String newName) { |
||||
selectCount.setFormulaCount(ContentReplaceUtil.replacePureFormula4TableDataName(selectCount.getFormulaCount(), oldName, newName)); |
||||
} |
||||
}; |
||||
public static final ContentReplacer<SelectCount> SelectCount4WidgetNameContentReplacer = new ContentReplacer<SelectCount>() { |
||||
@Override |
||||
public void replace(SelectCount selectCount, String oldName, String newName) { |
||||
selectCount.setFormulaCount(ContentReplaceUtil.replacePureFormula4WidgetName(selectCount.getFormulaCount(), oldName, newName)); |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* tab块标题 |
||||
*/ |
||||
public static final ContentReplacer<CardSwitchButton> CardSwitchButton4TableDataNameContentReplacer = new ContentReplacer<CardSwitchButton>() { |
||||
@Override |
||||
public void replace(CardSwitchButton cardSwitchButton, String oldName, String newName) { |
||||
cardSwitchButton.setText(ContentReplaceUtil.replaceFormulaString4TableDataName(cardSwitchButton.getText(), oldName, newName)); |
||||
} |
||||
}; |
||||
|
||||
public static final ContentReplacer<CardSwitchButton> CardSwitchButton4WidgetNameContentReplacer = new ContentReplacer<CardSwitchButton>() { |
||||
@Override |
||||
public void replace(CardSwitchButton cardSwitchButton, String oldName, String newName) { |
||||
cardSwitchButton.setText(ContentReplaceUtil.replaceFormulaString4WidgetName(cardSwitchButton.getText(), oldName, newName)); |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* 悬浮提示 |
||||
*/ |
||||
public static final ContentReplacer<CellGUIAttr> CellGUIAttr4TableDataNameContentReplacer = new ContentReplacer<CellGUIAttr>() { |
||||
@Override |
||||
public void replace(CellGUIAttr cellGUIAttr, String oldName, String newName) { |
||||
cellGUIAttr.setTooltipText(ContentReplaceUtil.replaceFormulaString4TableDataName(cellGUIAttr.getTooltipText(), oldName, newName)); |
||||
} |
||||
}; |
||||
|
||||
public static final ContentReplacer<CellGUIAttr> CellGUIAttr4WidgetNameContentReplacer = new ContentReplacer<CellGUIAttr>() { |
||||
@Override |
||||
public void replace(CellGUIAttr cellGUIAttr, String oldName, String newName) { |
||||
cellGUIAttr.setTooltipText(ContentReplaceUtil.replaceFormulaString4WidgetName(cellGUIAttr.getTooltipText(), oldName, newName)); |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* 图表/报表块等标题 |
||||
*/ |
||||
public static final ContentReplacer<WidgetTitle> WidgetTitle4TableDataNameContentReplacer = new ContentReplacer<WidgetTitle>() { |
||||
@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<WidgetTitle> WidgetTitle4WidgetNameContentReplacer = new ContentReplacer<WidgetTitle>() { |
||||
@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)); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
} |
@ -0,0 +1,65 @@
|
||||
package com.fr.design.mod; |
||||
|
||||
import junit.framework.TestCase; |
||||
import org.junit.Assert; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/6/2 |
||||
*/ |
||||
public class ContentReplaceUtilTest extends TestCase { |
||||
|
||||
public void testReplaceContent() { |
||||
String text = "setTimeout(function() {\n" + |
||||
"\n" + |
||||
"\t$(\"div[widgetname=DATEEDITOR0]\").css({\n" + |
||||
"\n" + |
||||
"\t\t'opacity': '0.3'\n" + |
||||
"\n" + |
||||
"\t});\n" + |
||||
"\n" + |
||||
"}, 50);\n" + |
||||
"var a = \"dateEditor0\""; |
||||
String oldName = "dateEditor0"; |
||||
String newName = "dateEditor00"; |
||||
String result = "setTimeout(function() {\n" + |
||||
"\n" + |
||||
"\t$(\"div[widgetname=DATEEDITOR00]\").css({\n" + |
||||
"\n" + |
||||
"\t\t'opacity': '0.3'\n" + |
||||
"\n" + |
||||
"\t});\n" + |
||||
"\n" + |
||||
"}, 50);\n" + |
||||
"var a = \"dateEditor00\""; |
||||
Assert.assertEquals(result, ContentReplaceUtil.replaceContent(text, oldName, newName)); |
||||
|
||||
String text1 = "setInterval(function() {\n" + |
||||
"\t//获取当前body中tab的索引位置\n" + |
||||
" var aa = _g().getWidgetByName(\"tabpane00\").getShowIndex();\n" + |
||||
" //根据tab索引轮播tab块,索引从0开始,到最后一个tab块后跳转到第一个\n" + |
||||
"\tif(aa == TAB轮播-测试-2) {\n" + |
||||
" _g().getWidgetByName('tabpane00').showCardByIndex(0);\n" + |
||||
" } else {\n" + |
||||
"\n" + |
||||
" _g().getWidgetByName('tabpane00').showCardByIndex(aa + TAB轮播-测试-1);\n" + |
||||
" }\n" + |
||||
"}, TAB轮播-测试-2000);"; |
||||
String oldName1 = "tabpane00"; |
||||
String newName1 = "tabpane0"; |
||||
String result1 = "setInterval(function() {\n" + |
||||
"\t//获取当前body中tab的索引位置\n" + |
||||
" var aa = _g().getWidgetByName(\"tabpane0\").getShowIndex();\n" + |
||||
" //根据tab索引轮播tab块,索引从0开始,到最后一个tab块后跳转到第一个\n" + |
||||
"\tif(aa == TAB轮播-测试-2) {\n" + |
||||
" _g().getWidgetByName('tabpane0').showCardByIndex(0);\n" + |
||||
" } else {\n" + |
||||
"\n" + |
||||
" _g().getWidgetByName('tabpane0').showCardByIndex(aa + TAB轮播-测试-1);\n" + |
||||
" }\n" + |
||||
"}, TAB轮播-测试-2000);"; |
||||
Assert.assertEquals(result1, ContentReplaceUtil.replaceContent(text1, oldName1, newName1)); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue