Browse Source

Pull request #10456: REPORT-80695 【模板全局级别查找替换二期】

Merge in DESIGN/design from ~DESTINY.LIN/design:feature/x to feature/x

* commit 'b688e55822c67bd3e24b47e3016a80c7caecc80e':
  REPORT-80695 【模板全局级别查找替换二期】刪除多余常量
  REPORT-80695 【模板全局级别查找替换二期】合法性校验
  REPORT-80695 【模板全局级别查找替换二期】更改部分静态,删减多余代码
  REPORT-80695 【模板全局级别查找替换二期】去除多余引入,增加接口注释
  REPORT-80695 【模板全局级别查找替换二期】增加设置项的滚轮
  REPORT-80695 【模板全局级别查找替换二期】补充注释
  REPORT-80695 【模板全局级别查找替换二期】补充注释
  REPORT-80695 【模板全局级别查找替换二期】补充注释
  REPORT-80695 【模板全局级别查找替换二期】适配表格多出来的替换后内容这一列,以及部分校验内容
  REPORT-80695 【模板全局级别查找替换二期】设置项主要逻辑
  REPORT-80695 【模板全局级别查找替换二期】基础数据结构修改,适配多出来的替换后内容这一列
  REPORT-80695 【模板全局级别查找替换二期】工具类
  REPORT-80695 【模板全局级别查找替换二期】UI界面
feature/x
Destiny.Lin-林锦龙 2 years ago
parent
commit
f204595b0a
  1. 15
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  2. 35
      designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowValue.java
  3. 10
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/component/ComponentType.java
  4. 118
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java
  5. 41
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaTag.java
  6. 4
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/template/SearchTemplateFormulaAction.java
  7. 15
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/JSCheckTag.java
  8. 70
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/js/JSCheckType.java
  9. 1
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/widget/FrmWidgetType.java
  10. 259
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/CellFormatType.java
  11. 245
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/CellGroupType.java
  12. 74
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/SettingContent.java
  13. 374
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/SettingController.java
  14. 82
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/action/SearchCellDSColumnAction.java
  15. 98
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/action/SearchCellFormatAction.java
  16. 114
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/action/SearchConnectionAction.java
  17. 87
      designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/action/SearchDSColumnAction.java
  18. 29
      designer-realize/src/main/java/com/fr/design/actions/replace/info/CellInfo.java
  19. 23
      designer-realize/src/main/java/com/fr/design/actions/replace/info/ComponentInfo.java
  20. 28
      designer-realize/src/main/java/com/fr/design/actions/replace/info/DataSourceInfo.java
  21. 14
      designer-realize/src/main/java/com/fr/design/actions/replace/info/FloatInfo.java
  22. 16
      designer-realize/src/main/java/com/fr/design/actions/replace/info/Info.java
  23. 31
      designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java
  24. 30
      designer-realize/src/main/java/com/fr/design/actions/replace/info/WidgetInfo.java
  25. 55
      designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java
  26. 96
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITCheckDialog.java
  27. 64
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITCheckEditor.java
  28. 392
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  29. 453
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  30. 20
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java
  31. 62
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java
  32. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java
  33. 77
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java
  34. 46
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java
  35. 7
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java
  36. 86
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

15
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -139,6 +139,15 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
return true;
}
/**
* 获取UICheckBox的UI层可以用于设置UI
*
* @return UICheckBoxUI
*/
public UICheckBoxUI getUICheckBoxUI(){
return new UICheckBoxUI();
}
private class UICheckBoxUI extends MetalCheckBoxUI {
@Override
public synchronized void paint(Graphics g, JComponent c) {
@ -186,9 +195,9 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
}
if (model.isSelected()) {
UIConstants.YES_ICON.paintIcon(c, g, iconRect.x + 2, iconRect.y + 2);
}
if (model.isSelected()) {
UIConstants.YES_ICON.paintIcon(c, g, iconRect.x + 2, iconRect.y + 2);
}
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
// Draw the Text

35
designer-realize/src/main/java/com/fr/design/actions/replace/action/ShowValue.java

@ -3,6 +3,7 @@ package com.fr.design.actions.replace.action;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.mainframe.JTemplate;
import java.util.ArrayList;
import java.util.List;
/**
@ -17,18 +18,36 @@ public interface ShowValue {
/**
* 获取搜索结果
*
* @param jTemplate
* @return
* @param jTemplate 要搜索的模板
* @return 所有对应类型的集合
*/
List<? extends Info> showSearchValue(JTemplate jTemplate);
default List<? extends Info> showSearchValue(JTemplate jTemplate) {
return new ArrayList<>();
}
/**
* 对搜索结果进行过滤
* 对搜索结果进行过滤主要针对模板内容只需要用户输入要搜索的文本内容即可
*
* @param str
* @param list
* @return
* @param str 用户输入的内容
* @param list 包含所有内容的列表
* @return 过滤后的内容
*/
List<? extends Info> addMatchResult(String str, List<? extends Info> list);
default List<? extends Info> addMatchResult(String str, List<? extends Info> list) {
return new ArrayList<>();
}
/**
* 对搜索结果进行过滤多个过滤条件主要针对设置项
* 通过用户输入的级别去界定指定的搜索类型
*
* @param list 包含所有内容的列表
* @param settingStr 用户输入的第一级下拉框内容
* @param extraStr 用户输入的第二级下拉框内容
* @return 界定后符合条件的内容组合成的列表
*/
default List<? extends Info> addMatchResult(List<? extends Info> list, String settingStr, String extraStr) {
return new ArrayList<>();
}
}

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;
}

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

@ -0,0 +1,70 @@
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;
}
/**
* 校验是否修改
* @param info 存储信息的数据结构
* @return
*/
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);

259
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/CellFormatType.java

@ -0,0 +1,259 @@
package com.fr.design.actions.replace.action.setting;
import com.fr.base.CoreDecimalFormat;
import com.fr.base.NameStyle;
import com.fr.base.TextFormat;
import com.fr.data.core.FormatField;
import com.fr.design.actions.replace.info.Info;
import com.fr.general.date.FineDateFormat;
import com.fr.report.cell.CellElement;
import com.fr.stable.StringUtils;
import org.jetbrains.annotations.Nullable;
import java.text.Format;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 单元格-格式
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-25
*/
public enum CellFormatType {
/**
* 单元格-格式-数字
*/
CELL_FORMAT_NUMBER(SettingContent.FORMAT_NUMBER) {
@Override
public boolean hasExpand(String parentStr) {
return true;
}
@Override
public List<String> getItems() {
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_NUMBER)));
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
Format format = cellElement.getStyle().getFormat();
return format instanceof CoreDecimalFormat && StringUtils.equals(((CoreDecimalFormat) format).toPattern(), secondStr);
}
},
/**
* 单元格-格式-常规
*/
CELL_FORMAT_COMMON(SettingContent.FORMAT_COMMON) {
@Override
public List<String> getItems() {
return super.getItems();
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
return cellElement.getStyle().getFormat() == null;
}
},
/**
* 单元格-格式-货币
*/
CELL_FORMAT_MONEY(SettingContent.FORMAT_MONEY) {
@Override
public boolean hasExpand(String parentStr) {
return true;
}
@Override
public List<String> getItems() {
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_MONEY)));
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
Format format = cellElement.getStyle().getFormat();
return format instanceof CoreDecimalFormat && StringUtils.equals(((CoreDecimalFormat) format).toPattern(), secondStr);
}
},
/**
* 单元格-格式-日期
*/
CELL_FORMAT_DATE(SettingContent.FORMAT_DATE) {
@Override
public boolean hasExpand(String parentStr) {
return true;
}
@Override
public List<String> getItems() {
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_DATE)));
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
Format format = cellElement.getStyle().getFormat();
return format instanceof FineDateFormat && StringUtils.equals(((FineDateFormat) format).toPattern(), secondStr);
}
},
/**
* 单元格-格式-时间
*/
CELL_FORMAT_TIME(SettingContent.FORMAT_TIME) {
@Override
public boolean hasExpand(String parentStr) {
return true;
}
@Override
public List<String> getItems() {
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_TIME)));
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
Format format = cellElement.getStyle().getFormat();
return format instanceof FineDateFormat && StringUtils.equals(((FineDateFormat) format).toPattern(), secondStr);
}
},
/**
* 单元格-格式-科学计数
*/
CELL_FORMAT_SCIENCE(SettingContent.FORMAT_SCIENCE) {
@Override
public boolean hasExpand(String parentStr) {
return true;
}
@Override
public List<String> getItems() {
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_SCIENCE)));
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
Format format = cellElement.getStyle().getFormat();
return format instanceof CoreDecimalFormat && StringUtils.equals(((CoreDecimalFormat) format).toPattern(), secondStr);
}
},
/**
* 单元格-格式-百分比
*/
CELL_FORMAT_PERCENT(SettingContent.FORMAT_PERCENT) {
@Override
public boolean hasExpand(String parentStr) {
return true;
}
@Override
public List<String> getItems() {
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_PERCENT)));
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
Format format = cellElement.getStyle().getFormat();
return format instanceof CoreDecimalFormat && StringUtils.equals(((CoreDecimalFormat) format).toPattern(), secondStr);
}
},
/**
* 单元格-格式-千分比
*/
CELL_FORMAT_PERMILLAGE(SettingContent.FORMAT_PERMILLAGE) {
@Override
public boolean hasExpand(String parentStr) {
return true;
}
@Override
public List<String> getItems() {
return Arrays.asList(FormatField.getInstance().getFormatArray(FormatField.getInstance().getContents(SettingContent.FORMAT_PERMILLAGE)));
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
Format format = cellElement.getStyle().getFormat();
return format instanceof CoreDecimalFormat && StringUtils.equals(((CoreDecimalFormat) format).toPattern(), secondStr);
}
},
/**
* 单元格-格式-文本
*/
CELL_FORMAT_TEXT(SettingContent.FORMAT_TEXT) {
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
Format format = cellElement.getStyle().getFormat();
return format instanceof TextFormat;
}
};
private String name;
CellFormatType(String name) {
this.name = name;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static CellFormatType match(String name) {
CellFormatType[] values = CellFormatType.values();
for (CellFormatType value : values) {
if (StringUtils.equals(value.name, name)) {
return value;
}
}
return null;
}
/**
* 是否能扩展选项
*
* @return 能扩展则返回true
*/
public boolean hasExpand(String parentStr) {
return false;
}
/**
* 获取界面数据
*/
public List<String> getItems() {
return new ArrayList<>();
}
/**
* 是否是要查找的内容
*
* @param cellElement
* @param firstStr
* @param secondStr
* @return
*/
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
return false;
}
/**
* 替换
*
* @param info 存储信息的数据结构
* @param firstStr 用户输入的第一级下拉框内容
* @param secondStr 用户输入的第二级下拉框内容
*/
public void replace(Info info, String firstStr, String secondStr) {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
cellElement.setStyle(cellElement.getStyle().deriveFormat(FormatField.getInstance().getFormat(FormatField.getInstance().getContents(firstStr), secondStr)));
if (cellElement.getStyle() instanceof NameStyle) {
((NameStyle) cellElement.getStyle()).refreshStyle();
}
}
}

245
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/CellGroupType.java

@ -0,0 +1,245 @@
package com.fr.design.actions.replace.action.setting;
import com.fr.data.util.function.AverageFunction;
import com.fr.data.util.function.CountFunction;
import com.fr.data.util.function.DataFunction;
import com.fr.data.util.function.MaxFunction;
import com.fr.data.util.function.MinFunction;
import com.fr.data.util.function.NoneFunction;
import com.fr.data.util.function.SumFunction;
import com.fr.design.actions.replace.info.Info;
import com.fr.report.cell.CellElement;
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.RecordGrouper;
import com.fr.report.cell.cellattr.core.group.SummaryGrouper;
import com.fr.stable.StringUtils;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 处理单元格的格式对于高级由于需要自定义不加入处理范围
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-26
*/
public enum CellGroupType {
/**
* 分组
*/
GROUP(SettingContent.DIGIT_SETTING_GROUP) {
@Override
public List<String> getItems() {
List<String> items = new ArrayList<String>() {
{
add(SettingContent.GROUP_COMMON);
add(SettingContent.GROUP_CONTINUUM);
}
};
return items;
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
DSColumn column = (DSColumn) cellElement.getValue();
RecordGrouper grouper = column.getGrouper();
return grouper instanceof FunctionGrouper && grouper.getDivideMode() == getGroupType(secondStr);
}
},
/**
* 列表
*/
LIST(SettingContent.DIGIT_SETTING_LIST) {
@Override
public boolean hasExpand(String parentStr) {
return false;
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
DSColumn column = (DSColumn) cellElement.getValue();
RecordGrouper grouper = column.getGrouper();
return grouper instanceof FunctionGrouper && grouper.getDivideMode() == getGroupType(firstStr);
}
},
/**
* 汇总
*/
SUM(SettingContent.DIGIT_SETTING_SUM) {
@Override
public List<String> getItems() {
List<String> items = new ArrayList<String>() {
{
add(SettingContent.SUMMARY_SUM);
add(SettingContent.SUMMARY_AVERAGE);
add(SettingContent.SUMMARY_MAX);
add(SettingContent.SUMMARY_MIN);
add(SettingContent.SUMMARY_COUNT);
add(SettingContent.SUMMARY_NONE);
}
};
return items;
}
@Override
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
DSColumn column = (DSColumn) cellElement.getValue();
RecordGrouper grouper = column.getGrouper();
return grouper instanceof SummaryGrouper && ((SummaryGrouper) grouper).getFunction() != null && StringUtils.equals(((SummaryGrouper) grouper).getFunction().getClass().getSimpleName(), getSummaryType(secondStr));
}
@Override
public void replace(Info info, String firstStr, String secondStr) {
SummaryGrouper grouper = new SummaryGrouper();
grouper.setFunction(createDataFunction(secondStr));
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
DSColumn column = (DSColumn) cellElement.getValue();
column.setGrouper(grouper);
}
};
private String name;
private Map<String, Integer> groupMap = new HashMap<String, Integer>() {
{
put(SettingContent.GROUP_COMMON, FunctionGrouper.GROUPING_MODE);
put(SettingContent.GROUP_CONTINUUM, FunctionGrouper.CONTINUUM_MODE);
put(SettingContent.DIGIT_LIST, FunctionGrouper.LIST_MODE);
}
};
private Map<String, String> summaryMap = new HashMap<String, String>() {
{
put(SettingContent.SUMMARY_SUM, SUM_FUNCTION);
put(SettingContent.SUMMARY_AVERAGE, AVERAGE_FUNCTION);
put(SettingContent.SUMMARY_MAX, MAX_FUNCTION);
put(SettingContent.SUMMARY_MIN, MIN_FUNCTION);
put(SettingContent.SUMMARY_COUNT, COUNT_FUNCTION);
put(SettingContent.SUMMARY_NONE, NONE_FUNCTION);
}
};
public static final String SUM_FUNCTION = "SumFunction";
public static final String AVERAGE_FUNCTION = "AverageFunction";
public static final String MAX_FUNCTION = "MaxFunction";
public static final String MIN_FUNCTION = "MinFunction";
public static final String COUNT_FUNCTION = "CountFunction";
public static final String NONE_FUNCTION = "NoneFunction";
CellGroupType(String name) {
this.name = name;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static CellGroupType match(String name) {
CellGroupType[] values = CellGroupType.values();
for (CellGroupType value : values) {
if (StringUtils.equals(value.name, name)) {
return value;
}
}
return null;
}
/**
* 是否是要查找的内容
*
* @param cellElement
* @param firstStr
* @param secondStr
* @return
*/
public boolean isNeed(CellElement cellElement, String firstStr, String secondStr) {
DSColumn column = (DSColumn) cellElement.getValue();
RecordGrouper recordGrouper = column.getGrouper();
return recordGrouper instanceof FunctionGrouper && recordGrouper.getDivideMode() == getGroupType(secondStr);
}
/**
* 匹配分组
*
* @param str
* @return
*/
public Integer getGroupType(String str) {
return groupMap.getOrDefault(str, -1);
}
/**
* 匹配汇总
*/
public String getSummaryType(String str) {
return summaryMap.getOrDefault(str, StringUtils.EMPTY);
}
/**
* 创建对应汇总的DataFunction
*
* @param str 汇总子级下拉框的内容
* @return 指定类型的DataFunction
*/
public DataFunction createDataFunction(String str) {
switch (getSummaryType(str)) {
case SUM_FUNCTION:
return new SumFunction();
case AVERAGE_FUNCTION:
return new AverageFunction();
case MAX_FUNCTION:
return new MaxFunction();
case MIN_FUNCTION:
return new MinFunction();
case COUNT_FUNCTION:
return new CountFunction();
default:
return new NoneFunction();
}
}
/**
* 是否能扩展选项
*
* @return 能扩展则返回true
*/
public boolean hasExpand(String parentStr) {
return true;
}
/**
* 获取界面数据
*/
public List<String> getItems() {
return new ArrayList<>();
}
/**
* 替换
*
* @param info 存储信息的数据结构
* @param firstStr 用户输入的第一级下拉框
* @param secondStr 用户输入的第二级下拉框
*/
public void replace(Info info, String firstStr, String secondStr) {
FunctionGrouper grouper = new FunctionGrouper();
grouper.setDivideMode(getGroupType(secondStr));
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
DSColumn column = (DSColumn) cellElement.getValue();
column.setGrouper(grouper);
}
}

74
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/SettingContent.java

@ -0,0 +1,74 @@
package com.fr.design.actions.replace.action.setting;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.i18n.Toolkit;
/**
* 设置项的一些常用常量
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-24
*/
public class SettingContent {
public static final String CELL_FORMAT_NAME = ShowValueUtils.joinStr4Position(Toolkit.i18nText("Fine-Design_Basic_Cell"), Toolkit.i18nText("Fine-Design_Report_Base_Format"));
public static final String CELL_DATA_SETTING_NAME = ShowValueUtils.joinStr4Position(Toolkit.i18nText("Fine-Design_Basic_Cell"), Toolkit.i18nText("Fine-Design_Chart_Data_Setting"));
public static final String CELL_DS_COLUMN_NAME = ShowValueUtils.joinStr4Position(Toolkit.i18nText("Fine-Design_Basic_Cell"), Toolkit.i18nText("Fine-Design_Basic_DS_Column"));
public static final String DATASOURCE_CONNECTION_NAME = ShowValueUtils.joinStr4Position(Toolkit.i18nText("Fine-Design_Replace_Data_Source"), Toolkit.i18nText("Fine-Design_Replace_Data_Connection"));
public static final String DATASOURCE_COLLECT_NAME = ShowValueUtils.joinStr4Position(Toolkit.i18nText("Fine-Design_Replace_Data_Source"), Toolkit.i18nText("Fine-Design_Replace_Data_Collect"));
/**
* 单元格-格式
*/
public static final String FORMAT_COMMON = Toolkit.i18nText("Fine-Design_Replace_Common");
public static final String FORMAT_NUMBER = Toolkit.i18nText("Fine-Design_Replace_Number");
public static final String FORMAT_MONEY = Toolkit.i18nText("Fine-Design_Replace_Money");
public static final String FORMAT_PERCENT = Toolkit.i18nText("Fine-Design_Replace_Percent");
public static final String FORMAT_PERMILLAGE = Toolkit.i18nText("Fine-Design_Replace_Permillage");
public static final String FORMAT_SCIENCE = Toolkit.i18nText("Fine-Design_Replace_Science");
public static final String FORMAT_DATE = Toolkit.i18nText("Fine-Design_Replace_Date");
public static final String FORMAT_TIME = Toolkit.i18nText("Fine-Design_Replace_Time");
public static final String FORMAT_TEXT = Toolkit.i18nText("Fine-Design_Replace_Text");
/**
* 单元格-数据设置
*/
public static final String DIGIT_SETTING_GROUP = Toolkit.i18nText("Fine-Design_Replace_Group");
public static final String DIGIT_SETTING_LIST = Toolkit.i18nText("Fine-Design_Replace_List");
public static final String DIGIT_SETTING_SUM = Toolkit.i18nText("Fine-Design_Replace_Sum");
/**
* 单元格-数据设置-分组
*/
public static final String GROUP_COMMON = Toolkit.i18nText("Fine-Design_Report_Common");
public static final String GROUP_CONTINUUM = Toolkit.i18nText("Fine-Design_Report_Continuum");
/**
* 单元格-数据设置-列表
*/
public static final String DIGIT_LIST = Toolkit.i18nText("Fine-Design_Report_Bind_Column_Select");
/**
* 单元格-数据设置-汇总
*/
public static final String SUMMARY_SUM = Toolkit.i18nText("Fine-Design_DataFunction_Sum");
public static final String SUMMARY_AVERAGE = Toolkit.i18nText("Fine-Design_DataFunction_Average");
public static final String SUMMARY_MAX = Toolkit.i18nText("Fine-Design_DataFunction_Max");
public static final String SUMMARY_MIN = Toolkit.i18nText("Fine-Design_DataFunction_Min");
public static final String SUMMARY_COUNT = Toolkit.i18nText("Fine-Design_DataFunction_Count");
public static final String SUMMARY_NONE = Toolkit.i18nText("Fine-Design_DataFunction_None");
/**
* 数据连接
*/
public static final String CONNECTION_TEMPLATE = Toolkit.i18nText("Fine-Design_Basic_DS_Report_TableData");
/**
* 扩展出来的可能的选项
*/
public static final String DS_COLUMN_EXPEND = "DS_COLUMN_EXPEND";
}

374
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/SettingController.java

@ -0,0 +1,374 @@
package com.fr.design.actions.replace.action.setting;
import com.fr.data.TableDataSource;
import com.fr.design.actions.replace.action.ShowValue;
import com.fr.design.actions.replace.action.setting.action.SearchCellDSColumnAction;
import com.fr.design.actions.replace.action.setting.action.SearchCellFormatAction;
import com.fr.design.actions.replace.action.setting.action.SearchConnectionAction;
import com.fr.design.actions.replace.action.setting.action.SearchDSColumnAction;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.actions.replace.info.DataSourceInfo;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.ui.ITReplaceNorthPanel;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.ConnectionConfig;
import com.fr.general.data.TableDataColumn;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.stable.StringUtils;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* 设置项的查找内容
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-24
*/
public enum SettingController implements ShowValue {
/**
* 单元格-格式
*/
CELL_FORMAT(SettingContent.CELL_FORMAT_NAME) {
@Override
public List<String> getItems() {
return ITReplaceNorthPanel.formatItems;
}
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchCellFormatAction.getInstance().search4Infos(jTemplate);
return SearchCellFormatAction.getInstance().getCellInfos();
}
@Override
public List<? extends Info> addMatchResult(List<? extends Info> list, String settingStr, String extraStr) {
List<CellInfo> cellInfos = new ArrayList<>();
for (Info info : list) {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
CellFormatType type = CellFormatType.match(settingStr);
if (type != null && type.isNeed(cellElement, settingStr, extraStr)) {
cellInfos.add((CellInfo) info);
}
}
return cellInfos;
}
@Override
public boolean hasExpand(String str, String parentStr) {
CellFormatType type = CellFormatType.match(parentStr);
if (type != null) {
return type.hasExpand(parentStr);
}
return false;
}
@Override
public List<String> getExtraItems(String str) {
CellFormatType type = CellFormatType.match(str);
if (type != null) {
return type.getItems();
}
return new ArrayList<>();
}
@Override
public void replace(Info info, String firstStr, String secondStr) {
CellFormatType type = CellFormatType.match(firstStr);
if (type != null) {
type.replace(info, firstStr, secondStr);
}
}
},
/**
* 单元格-数据设置
*/
CELL_DATA_SETTING(SettingContent.CELL_DATA_SETTING_NAME) {
@Override
public List<String> getItems() {
return ITReplaceNorthPanel.digitItems;
}
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchCellDSColumnAction.getInstance().search4Infos(jTemplate);
return SearchCellDSColumnAction.getInstance().getCellInfos();
}
@Override
public List<? extends Info> addMatchResult(List<? extends Info> list, String settingStr, String extraStr) {
List<CellInfo> cellInfos = new ArrayList<>();
for (Info info : list) {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
//能到这步说明单元格里是数据列
CellGroupType cellGroupType = CellGroupType.match(settingStr);
if (cellGroupType != null && cellGroupType.isNeed(cellElement, settingStr, extraStr)) {
cellInfos.add((CellInfo) info);
}
}
return cellInfos;
}
@Override
public List<String> getExtraItems(String str) {
CellGroupType type = CellGroupType.match(str);
if (type != null) {
return type.getItems();
}
return new ArrayList<>();
}
@Override
public boolean hasExpand(String str, String parentStr) {
CellGroupType type = CellGroupType.match(parentStr);
if (type != null) {
return type.hasExpand(parentStr);
}
return false;
}
@Override
public void replace(Info info, String firstStr, String secondStr) {
CellGroupType type = CellGroupType.match(firstStr);
if (type != null) {
type.replace(info, firstStr, secondStr);
}
}
},
/**
* 单元格-数据列
*/
CELL_DS_COLUMN(SettingContent.CELL_DS_COLUMN_NAME) {
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchCellDSColumnAction.getInstance().search4Infos(jTemplate);
return SearchCellDSColumnAction.getInstance().getCellInfos();
}
@Override
public List<? extends Info> addMatchResult(List<? extends Info> list, String settingStr, String extraStr) {
List<CellInfo> cellInfos = new ArrayList<>();
for (Info info : list) {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
//能到这步说明单元格里是数据列
DSColumn dsColumn = (DSColumn) cellElement.getValue();
if (isNeed(dsColumn, settingStr, extraStr)) {
cellInfos.add((CellInfo) info);
}
}
return cellInfos;
}
public boolean isNeed(DSColumn dsColumn, String settingStr, String extraStr) {
return dsColumn != null && StringUtils.equals(settingStr, dsColumn.getDSName()) && dsColumn.getColumn() != null && StringUtils.equals(dsColumn.getColumnName(), extraStr);
}
@Override
public List<String> getItems() {
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
List<String> tableDataArray = new ArrayList<>();
if (jTemplate != null && jTemplate.getTarget() instanceof TableDataSource) {
TableDataSource source = (TableDataSource) jTemplate.getTarget();
Iterator dataIterator = source.getTableDataNameIterator();
while (dataIterator.hasNext()) {
String dataName = (String) dataIterator.next();
tableDataArray.add(dataName);
}
}
return tableDataArray;
}
@Override
public List<String> getExtraItems(String str) {
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
List<String> tableDataArray = new ArrayList<>();
if (jTemplate != null) {
TableDataSource source = jTemplate.getTarget();
tableDataArray = Arrays.asList(DesignTableDataManager.getSelectedColumnNames(source, str));
}
return tableDataArray;
}
@Override
public boolean hasExpand(String str, String parentStr) {
return true;
}
@Override
public void replace(Info info, String firstStr, String secondStr) {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
DSColumn dsColumn = (DSColumn) cellElement.getValue();
dsColumn.setDSName(firstStr);
dsColumn.setColumn(TableDataColumn.createColumn(secondStr));
}
},
/**
* 数据源-数据连接
*/
DATASOURCE_CONNECTION(SettingContent.DATASOURCE_CONNECTION_NAME) {
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchConnectionAction.getInstance().search4Infos(jTemplate);
return SearchConnectionAction.getInstance().getConnectionInfos();
}
@Override
public List<? extends Info> addMatchResult(List<? extends Info> list, String settingStr, String extraStr) {
List<DataSourceInfo> connectionInfos = new ArrayList<>();
for (Info info : list) {
if (StringUtils.equals(info.getContent().getShowStr(), settingStr)) {
connectionInfos.add((DataSourceInfo) info);
}
}
return connectionInfos;
}
@Override
public List<String> getItems() {
List<String> nameList = new ArrayList<>();
for (String name : ConnectionConfig.getInstance().getConnections().keySet()) {
nameList.add(name);
}
return nameList;
}
},
/**
* 数据源-数据集
*/
DATASOURCE_COLLECT(SettingContent.DATASOURCE_COLLECT_NAME) {
@Override
public List<? extends Info> showSearchValue(JTemplate jTemplate) {
SearchDSColumnAction.getInstance().search4Infos(jTemplate);
return SearchDSColumnAction.getInstance().getDsColumnInfos();
}
@Override
public List<? extends Info> addMatchResult(List<? extends Info> list, String settingStr, String extraStr) {
return list;
}
@Override
public List<String> getItems() {
return ITReplaceNorthPanel.dsColumnItems;
}
};
private String name;
SettingController(String name) {
this.name = name;
}
/**
* 匹配
*
* @param name
* @return
*/
@Nullable
public static SettingController match(String name) {
SettingController[] values = SettingController.values();
for (SettingController value : values) {
if (StringUtils.equals(value.name, name)) {
return value;
}
}
return null;
}
/**
* 获取界面的数据使之与选项匹配
*
* @param name 选项
*/
public static List<String> getSettingRefreshItems(String name) {
SettingController[] values = SettingController.values();
for (SettingController value : values) {
if (StringUtils.equals(value.name, name)) {
return value.getItems();
}
}
return new ArrayList<>();
}
/**
* 获取界面的数据使之与选项匹配
*
* @param parentStr 选项
*/
public static List<String> getSettingExtraRefreshItems(String str, String parentStr) {
SettingController[] values = SettingController.values();
for (SettingController value : values) {
if (StringUtils.equals(value.name, str)) {
return value.getExtraItems(parentStr);
}
}
return new ArrayList<>();
}
/**
* 获取界面数据
*/
public List<String> getItems() {
return new ArrayList<>();
}
/**
* 获取扩展数据
*
* @param str 父类名称
* @return 扩展的数据列表
*/
public List<String> getExtraItems(String str) {
return new ArrayList<>();
}
/**
* 是否能扩展选项
*
* @return 能扩展则返回true
*/
public boolean hasExpand(String str, String parentStr) {
return false;
}
/**
* 替换
*
* @param info 存储信息的数据结构
* @param firstStr 用户设定的第一级下拉框的内容
* @param secondStr 用户设定的第二级下拉框的内容
*/
public void replace(Info info, String firstStr, String secondStr) {
}
/**
* 是否修改过
*
* @param info 存储信息的数据结构
* @param inputStr 用户搜索的一级下拉框内容
* @param extraStr 用户搜索的二级下拉框内容
* @return 没修改过则返回false
*/
public boolean isEverChanged(Info info, String inputStr, String extraStr) {
return false;
}
}

82
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/action/SearchCellDSColumnAction.java

@ -0,0 +1,82 @@
package com.fr.design.actions.replace.action.setting.action;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.content.cell.SearchCellAction;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.GeneralUtils;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import java.util.ArrayList;
import java.util.List;
/**
* 存储单元格-数据列
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-26
*/
public class SearchCellDSColumnAction implements SearchAction {
private List<CellInfo> cellInfos = new ArrayList<>();
private SearchCellDSColumnAction() {
}
@Override
public void search4Infos(JTemplate jTemplate) {
List<CellInfo> cellInfos = new ArrayList<>();
SearchCellAction.getInstance().search4Infos(jTemplate);
for (CellInfo info : SearchCellAction.getInstance().getCellInfos()) {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
if (cellElement.getValue() instanceof DSColumn) {
info.getContent().setShowStr(GeneralUtils.objectToString(cellElement.getValue()));
cellInfos.add(info);
}
}
setCellInfos(cellInfos);
}
public List<CellInfo> getCellInfos() {
return cellInfos;
}
public void setCellInfos(List<CellInfo> cellInfos) {
this.cellInfos = cellInfos;
}
/**
* 对外开放的获取对象的方法
*
* @return
*/
public static SearchCellDSColumnAction getInstance() {
return SearchCellDSColumnActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCellDSColumnActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchCellDSColumnAction instance;
SearchCellDSColumnActionEnum() {
instance = new SearchCellDSColumnAction();
}
/**
* 获取对象
*
* @return
*/
public SearchCellDSColumnAction getInstance() {
return instance;
}
}
}

98
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/action/SearchCellFormatAction.java

@ -0,0 +1,98 @@
package com.fr.design.actions.replace.action.setting.action;
import com.fr.base.Formula;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.action.content.cell.SearchCellAction;
import com.fr.design.actions.replace.info.CellInfo;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.GeneralUtils;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import java.util.ArrayList;
import java.util.List;
/**
* 存储有格式的单元格
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-25
*/
public class SearchCellFormatAction implements SearchAction {
private List<CellInfo> cellInfos = new ArrayList<>();
private SearchCellFormatAction() {
}
@Override
public void search4Infos(JTemplate jTemplate) {
List<CellInfo> cellInfos = new ArrayList<>();
SearchCellAction.getInstance().search4Infos(jTemplate);
for (CellInfo info : SearchCellAction.getInstance().getCellInfos()) {
CellElement cellElement = (CellElement) info.getContent().getReplaceObject();
if (isFormatValid(cellElement)) {
info.getContent().setShowStr(GeneralUtils.objectToString(cellElement.getValue()));
cellInfos.add(info);
}
}
setCellInfos(cellInfos);
}
/**
* 单元格的内容是否是在查找范围内
*
* @param cellElement 单元格
* @return 在查找范围内返回true
*/
public boolean isFormatValid(CellElement cellElement) {
return cellElement.getStyle() != null
&& (cellElement.getValue() instanceof Formula
|| cellElement.getValue() instanceof DSColumn
|| cellElement.getValue() instanceof String
|| cellElement.getValue() instanceof Integer);
}
public List<CellInfo> getCellInfos() {
return cellInfos;
}
public void setCellInfos(List<CellInfo> cellInfos) {
this.cellInfos = cellInfos;
}
/**
* 对外开放的获取对象的方法
*
* @return
*/
public static SearchCellFormatAction getInstance() {
return SearchCellFormatActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchCellFormatActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchCellFormatAction instance;
SearchCellFormatActionEnum() {
instance = new SearchCellFormatAction();
}
/**
* 获取对象
*
* @return
*/
public SearchCellFormatAction getInstance() {
return instance;
}
}
}

114
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/action/SearchConnectionAction.java

@ -0,0 +1,114 @@
package com.fr.design.actions.replace.action.setting.action;
import com.fr.base.TableData;
import com.fr.base.TableDataConnection;
import com.fr.data.TableDataSource;
import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.info.DataSourceInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.ConnectionConfig;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* 存储数据连接信息
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-26
*/
public class SearchConnectionAction implements SearchAction {
private List<DataSourceInfo> connectionInfos = new ArrayList<>();
private SearchConnectionAction() {
}
@Override
public void search4Infos(JTemplate jTemplate) {
List<DataSourceInfo> connectionInfos = new ArrayList<>();
Map<String, Connection> map = ConnectionConfig.getInstance().getConnections();
Map<String, Connection> needMap = new HashMap<>();
TableDataSource source = (TableDataSource) jTemplate.getTarget();
Iterator dataIterator = source.getTableDataNameIterator();
while (dataIterator.hasNext()) {
String dataName = (String) dataIterator.next();
TableData data = source.getTableData(dataName);
if (isNameDataBaseConnectionValid(data)) {
NameDatabaseConnection connection = (NameDatabaseConnection) ((TableDataConnection) data).getDatabase();
if (map.containsKey(connection.getName())) {
needMap.put(connection.getName(), connection);
}
}
}
for (String name : needMap.keySet()) {
ITContent content = new ITContent();
content.setReplaceObject(needMap.get(name));
content.setTemplateName(jTemplate.getTemplateName());
content.setJumpAble(false);
content.setShowStr(name);
connectionInfos.add(new DataSourceInfo(content));
}
setConnectionInfos(connectionInfos);
}
/**
* 数据连接是否可用
*
* @param data 数据库
* @return 可用返回true
*/
public boolean isNameDataBaseConnectionValid(TableData data) {
return data instanceof TableDataConnection && ((TableDataConnection) data).getDatabase() instanceof NameDatabaseConnection;
}
public List<DataSourceInfo> getConnectionInfos() {
return connectionInfos;
}
public void setConnectionInfos(List<DataSourceInfo> connectionInfos) {
this.connectionInfos = connectionInfos;
}
/**
* 对外开放的获取对象的方法
*
* @return
*/
public static SearchConnectionAction getInstance() {
return SearchConnectionActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchConnectionActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchConnectionAction instance;
SearchConnectionActionEnum() {
instance = new SearchConnectionAction();
}
/**
* 获取对象
*
* @return
*/
public SearchConnectionAction getInstance() {
return instance;
}
}
}

87
designer-realize/src/main/java/com/fr/design/actions/replace/action/setting/action/SearchDSColumnAction.java

@ -0,0 +1,87 @@
package com.fr.design.actions.replace.action.setting.action;
import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import com.fr.design.actions.replace.action.SearchAction;
import com.fr.design.actions.replace.info.DataSourceInfo;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.mainframe.JTemplate;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 搜索数据列
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-26
*/
public class SearchDSColumnAction implements SearchAction {
private List<DataSourceInfo> dsColumnInfos = new ArrayList<>();
private SearchDSColumnAction() {
}
@Override
public void search4Infos(JTemplate jTemplate) {
List<DataSourceInfo> dsColumnInfos = new ArrayList<>();
TableDataSource source = (TableDataSource) jTemplate.getTarget();
Iterator dataIterator = source.getTableDataNameIterator();
while (dataIterator.hasNext()) {
String dataName = (String) dataIterator.next();
TableData data = source.getTableData(dataName);
ITContent content = new ITContent();
content.setJumpAble(false);
content.setReplaceObject(data);
content.setShowStr(dataName);
content.setTemplateName(jTemplate.getTemplateName());
dsColumnInfos.add(new DataSourceInfo(content));
setDsColumnInfos(dsColumnInfos);
}
}
public List<DataSourceInfo> getDsColumnInfos() {
return dsColumnInfos;
}
public void setDsColumnInfos(List<DataSourceInfo> dsColumnInfos) {
this.dsColumnInfos = dsColumnInfos;
}
/**
* 对外开放的获取对象的方法
*
* @return
*/
public static SearchDSColumnAction getInstance() {
return SearchDSColumnActionEnum.SINGLETON.getInstance();
}
/**
* 枚举实现单例
*/
private enum SearchDSColumnActionEnum {
/**
* 单例
*/
SINGLETON;
private SearchDSColumnAction instance;
SearchDSColumnActionEnum() {
instance = new SearchDSColumnAction();
}
/**
* 获取对象
*
* @return
*/
public SearchDSColumnAction getInstance() {
return instance;
}
}
}

29
designer-realize/src/main/java/com/fr/design/actions/replace/info/CellInfo.java

@ -99,10 +99,13 @@ public class CellInfo implements Info {
if (title.getTextObject() instanceof Formula) {
Formula formula = (Formula) title.getTextObject();
updateOldStr(formula.getContent(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, formula.getContent(), findStr, replaceStr);
formula.setContent(ShowValueUtils.replaceAll(formula.getContent(), findStr, replaceStr));
} else {
updateOldStr(GeneralUtils.objectToString(title.getTextObject()), findStr);
title.setTextObject(ShowValueUtils.replaceAll(GeneralUtils.objectToString(title.getTextObject()), findStr, replaceStr));
String str = GeneralUtils.objectToString(title.getTextObject());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
title.setTextObject(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
} else {
CellValueType cellValueType = CellValueType.match(cellElement.getValue().getClass().getSimpleName());
@ -110,7 +113,9 @@ public class CellInfo implements Info {
cellValueType.setValue(this, cellElement.getValue(), findStr, replaceStr);
} else {
updateOldStr(GeneralUtils.objectToString(cellElement.getValue()), findStr);
cellElement.setValue(ShowValueUtils.replaceAll(GeneralUtils.objectToString(cellElement.getValue()), findStr, replaceStr));
String str = GeneralUtils.objectToString(cellElement.getValue());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
cellElement.setValue(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
@ -205,7 +210,9 @@ public class CellInfo implements Info {
@Override
public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) {
cellInfo.updateOldStr(GeneralUtils.objectToString(((DSColumn) o).getDSName()), findStr);
((DSColumn) o).setDSName(ShowValueUtils.replaceAll(((DSColumn) o).getDSName(), findStr, replaceStr));
String str = ((DSColumn) o).getDSName();
ShowValueUtils.updateAfterReplaceStr(cellInfo, str, findStr, replaceStr);
((DSColumn) o).setDSName(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
@ -226,7 +233,9 @@ public class CellInfo implements Info {
@Override
public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) {
cellInfo.updateOldStr(GeneralUtils.objectToString(o), findStr);
((Formula) o).setContent(ShowValueUtils.replaceAll(((Formula) o).getContent(), findStr, replaceStr));
String str = ((Formula) o).getContent();
ShowValueUtils.updateAfterReplaceStr(cellInfo, str, findStr, replaceStr);
((Formula) o).setContent(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
@ -243,8 +252,10 @@ public class CellInfo implements Info {
@Override
public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) {
LinkWorkBookTemplate workBookTemplate = (LinkWorkBookTemplate) ((SubReport) o).getPackee();
cellInfo.updateOldStr(workBookTemplate.getTemplatePath(), findStr);
workBookTemplate.setTemplatePath(ShowValueUtils.replaceAll(workBookTemplate.getTemplatePath(), findStr, replaceStr));
String str = workBookTemplate.getTemplatePath();
cellInfo.updateOldStr(str, findStr);
ShowValueUtils.updateAfterReplaceStr(cellInfo, str, findStr, replaceStr);
workBookTemplate.setTemplatePath(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override
@ -267,8 +278,10 @@ public class CellInfo implements Info {
BIAS_TEXT_PAINTER("BiasTextPainter") {
@Override
public void setValue(CellInfo cellInfo, Object o, String findStr, String replaceStr) {
cellInfo.updateOldStr(((BiasTextPainter) o).getText(), findStr);
((BiasTextPainter) o).setText(ShowValueUtils.replaceAll(((BiasTextPainter) o).getText(), findStr, replaceStr));
String str = ((BiasTextPainter) o).getText();
cellInfo.updateOldStr(str, findStr);
ShowValueUtils.updateAfterReplaceStr(cellInfo, str, findStr, replaceStr);
((BiasTextPainter) o).setText(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
@Override

23
designer-realize/src/main/java/com/fr/design/actions/replace/info/ComponentInfo.java

@ -1,10 +1,14 @@
package com.fr.design.actions.replace.info;
import com.fr.design.actions.replace.action.content.component.ComponentType;
import com.fr.design.actions.replace.action.content.component.SearchComponentAction;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.ui.Widget;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import com.fr.stable.js.WidgetName;
import java.util.HashMap;
@ -79,4 +83,23 @@ public class ComponentInfo implements Info {
public String getInfoShowStr(Info info) {
return this.getContent().getOldShowStr();
}
@Override
public Boolean isLegalValid(JTemplate<?, ?> jTemplate, String searchStr, String replaceStr) {
if (StringUtils.isEmpty(replaceStr)) {
this.getContent().setCheckStr(Toolkit.i18nText("Fine-Design_Replace_Not_Empty"));
return false;
}
SearchComponentAction.getInstance().search4Infos(jTemplate);
List<ComponentInfo> list = SearchComponentAction.getInstance().getComponentInfos();
String replacedName = ((Widget)this.getContent().getReplaceObject()).getWidgetName().replace(searchStr, replaceStr);
for (ComponentInfo info : list) {
String widgetName = ((Widget)info.getContent().getReplaceObject()).getWidgetName();
if (StringUtils.equals(replacedName, widgetName)) {
this.getContent().setCheckStr(Toolkit.i18nText("Fine-Design_Replace_Exist_Same_Name"));
return false;
}
}
return true;
}
}

28
designer-realize/src/main/java/com/fr/design/actions/replace/info/DataSourceInfo.java

@ -0,0 +1,28 @@
package com.fr.design.actions.replace.info;
import com.fr.design.actions.replace.info.base.ITContent;
/**
* 存储数据源相关的信息后续数据源部分如果有自己额外的信息把这个当成父类进行拓展即可
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-28
*/
public class DataSourceInfo implements Info{
private ITContent content;
public DataSourceInfo(ITContent content) {
this.content = content;
}
@Override
public ITContent getContent() {
return content;
}
public void setContent(ITContent content) {
this.content = content;
}
}

14
designer-realize/src/main/java/com/fr/design/actions/replace/info/FloatInfo.java

@ -92,20 +92,26 @@ public class FloatInfo implements Info {
if (title.getTextObject() instanceof Formula) {
Formula formula = (Formula) title.getTextObject();
updateOldStr(formula.getContent(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, formula.getContent(), findStr, replaceStr);
formula.setContent(ShowValueUtils.replaceAll(formula.getContent(), findStr, replaceStr));
} else {
updateOldStr(GeneralUtils.objectToString(title.getTextObject()), findStr);
title.setTextObject(ShowValueUtils.replaceAll(GeneralUtils.objectToString(title.getTextObject()), findStr, replaceStr));
String str = GeneralUtils.objectToString(title.getTextObject());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
updateOldStr(str, findStr);
title.setTextObject(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
} else {
FloatElement floatElement = ((FloatElement) this.getContent().getReplaceObject());
if (floatElement.getValue() instanceof Formula) {
Formula formula = (Formula) floatElement.getValue();
updateOldStr(formula.getContent(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, formula.getContent(), findStr, replaceStr);
formula.setContent(ShowValueUtils.replaceAll(formula.getContent(), findStr, replaceStr));
} else {
updateOldStr(GeneralUtils.objectToString(floatElement.getValue()), findStr);
floatElement.setValue(ShowValueUtils.replaceAll(GeneralUtils.objectToString(floatElement.getValue()), findStr, replaceStr));
String str = GeneralUtils.objectToString(floatElement.getValue());
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
updateOldStr(str, findStr);
floatElement.setValue(ShowValueUtils.replaceAll(str, findStr, replaceStr));
}
}
}

16
designer-realize/src/main/java/com/fr/design/actions/replace/info/Info.java

@ -1,6 +1,7 @@
package com.fr.design.actions.replace.info;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.mainframe.JTemplate;
/**
@ -41,5 +42,18 @@ public interface Info extends DealWithInfoValue {
return true;
}
;
/**
* 校验合法性(内容是否合法
* 当前需要检测的目标
* 控件名值是否为空重名
* 组件名值是否为空重名
*
* @param jTemplate 要检测的模板
* @param searchStr 搜索的内容
* @param replaceStr 替换的内容
* @return 检测合法则返回true
*/
default Boolean isLegalValid(JTemplate<?, ?> jTemplate,String searchStr, String replaceStr) {
return true;
}
}

31
designer-realize/src/main/java/com/fr/design/actions/replace/info/ReplaceObject.java

@ -2,6 +2,7 @@ package com.fr.design.actions.replace.info;
import com.fr.data.impl.DBTableData;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.replace.action.content.js.JSCheckType;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane;
@ -47,10 +48,12 @@ public enum ReplaceObject implements DealWithInfoValue {
if (((JSInfo) info).isContent()) {
JavaScriptImpl javaScript = (JavaScriptImpl) ((NameJavaScript) (info.getContent().getReplaceObject())).getJavaScript();
info.updateOldStr(javaScript.getContent(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, javaScript.getContent(), findStr, replaceStr);
javaScript.setContent(ShowValueUtils.replaceAll(javaScript.getContent(), findStr, replaceStr));
} else {
NameJavaScript javaScript = ((NameJavaScript) (info.getContent().getReplaceObject()));
info.updateOldStr(javaScript.getName(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, javaScript.getName(), findStr, replaceStr);
javaScript.setName(ShowValueUtils.replaceAll(javaScript.getName(), findStr, replaceStr));
}
}
@ -94,10 +97,12 @@ public enum ReplaceObject implements DealWithInfoValue {
if (((JSInfo) info).isContent()) {
JavaScriptImpl javaScript = (JavaScriptImpl) ((Listener) (info.getContent().getReplaceObject())).getAction();
info.updateOldStr(javaScript.getContent(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, javaScript.getContent(), findStr, replaceStr);
javaScript.setContent(ShowValueUtils.replaceAll(javaScript.getContent(), findStr, replaceStr));
} else {
Listener listener = ((Listener) ((info.getContent().getReplaceObject())));
info.updateOldStr(listener.getName(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, listener.getName(), findStr, replaceStr);
listener.setName(ShowValueUtils.replaceAll(listener.getName(), findStr, replaceStr));
}
}
@ -141,6 +146,7 @@ public enum ReplaceObject implements DealWithInfoValue {
VanChartHtmlLabel htmlLabel = ((VanChartHtmlLabel) (info.getContent().getReplaceObject()));
StringBuilder stringBuilder = new StringBuilder(htmlLabel.getCustomText());
info.updateOldStr(htmlLabel.getCustomText(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, htmlLabel.getCustomText(), findStr, replaceStr);
htmlLabel.setCustomText(ShowValueUtils.replaceAll(htmlLabel.getCustomText(), findStr, replaceStr));
}
}
@ -175,6 +181,7 @@ public enum ReplaceObject implements DealWithInfoValue {
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
JavaScriptImpl javaScript = (JavaScriptImpl) (info.getContent().getReplaceObject());
info.updateOldStr(javaScript.getContent(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, javaScript.getContent(), findStr, replaceStr);
javaScript.setContent(ShowValueUtils.replaceAll(javaScript.getContent(), findStr, replaceStr));
}
@ -209,6 +216,7 @@ public enum ReplaceObject implements DealWithInfoValue {
String jsName = GeneralUtils.objectToString(info.getContent().getReplaceObject());
for (int i = 0, len = jsImports.size(); i < len; i++) {
if (StringUtils.equals(jsImports.get(i), jsName)) {
ShowValueUtils.updateAfterReplaceStr(info, jsName, findStr, replaceStr);
jsImports.set(i, ShowValueUtils.replaceAll(jsName, findStr, replaceStr));
}
}
@ -234,22 +242,23 @@ public enum ReplaceObject implements DealWithInfoValue {
*/
DB_TABLE_DATA("DBTableData") {
@Override
boolean check (Info info){
boolean check(Info info) {
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject();
return StringUtils.equals(dbTableData.getQuery(), info.getContent().getOldShowStr());
}
@Override
public Map<String, String> getValue (Object...o){
public Map<String, String> getValue(Object... o) {
HashMap<String, String> map = new HashMap<>();
addValue2Map(contentKey, ((DBTableData) o[0]).getQuery(), map);
return map;
}
@Override
public void setValue (Info info, String findStr, String replaceStr, List < Pair < Integer, Integer >> operatorArray){
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) {
DBTableData dbTableData = (DBTableData) info.getContent().getReplaceObject();
info.updateOldStr(dbTableData.getQuery(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, dbTableData.getQuery(), findStr, replaceStr);
dbTableData.setQuery(ShowValueUtils.replaceAll(dbTableData.getQuery(), findStr, replaceStr));
//清除缓存
DesignTableDataManager.removeSelectedColumnNames(dbTableData.getName());
@ -258,7 +267,7 @@ public enum ReplaceObject implements DealWithInfoValue {
}
@Override
public String getInfoShowStr (Info info){
public String getInfoShowStr(Info info) {
return info.getInfoShowStr(info);
}
};
@ -304,4 +313,18 @@ public enum ReplaceObject implements DealWithInfoValue {
abstract boolean check(Info info);
/**
* 修改会引入新对象的放入这里检查
*
* @param info
* @return
*/
public boolean checkQuote(Info info) {
JSCheckType o = JSCheckType.match(info.getContent().getTag());
if (o != null) {
return o.check(info);
}
return true;
}
}

30
designer-realize/src/main/java/com/fr/design/actions/replace/info/WidgetInfo.java

@ -4,12 +4,16 @@ import com.fr.design.actions.replace.action.content.widget.FrmWidgetType;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.actions.replace.utils.ShowValueUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.form.ui.WaterMark;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
import com.fr.stable.js.WidgetName;
import java.util.HashMap;
@ -66,10 +70,13 @@ public class WidgetInfo implements Info, DealWithInfoValue {
}
} else {
if (isWaterMark()) {
updateOldStr(((WaterMark) widget).getWaterMark(), findStr);
((WaterMark) widget).setWaterMark(ShowValueUtils.replaceAll(((WaterMark) widget).getWaterMark(), findStr, replaceStr));
String str = ((WaterMark) widget).getWaterMark();
updateOldStr(str, findStr);
ShowValueUtils.updateAfterReplaceStr(info, str, findStr, replaceStr);
((WaterMark) widget).setWaterMark(ShowValueUtils.replaceAll(str, findStr, replaceStr));
} else {
updateOldStr(widget.getWidgetName(), findStr);
ShowValueUtils.updateAfterReplaceStr(info, widget.getWidgetName(), findStr, replaceStr);
widget.setWidgetName(ShowValueUtils.replaceAll(widget.getWidgetName(), findStr, replaceStr));
}
}
@ -125,4 +132,23 @@ public class WidgetInfo implements Info, DealWithInfoValue {
}
@Override
public Boolean isLegalValid(JTemplate<?, ?> jTemplate,String searchStr, String replaceStr) {
if (StringUtils.isEmpty(replaceStr)) {
this.getContent().setCheckStr(Toolkit.i18nText("Fine-Design_Replace_Not_Empty"));
return false;
}
if (!this.isWaterMark()) {
String replacedName = ((Widget)this.getContent().getReplaceObject()).getWidgetName().replace(searchStr, replaceStr);
for (WidgetName name : jTemplate.getModel().getWidgetsName()) {
String widgetName = name.getName();
if (StringUtils.equals(replacedName, widgetName)) {
this.getContent().setCheckStr(Toolkit.i18nText("Fine-Design_Replace_Exist_Same_Name"));
return false;
}
}
}
return true;
}
}

55
designer-realize/src/main/java/com/fr/design/actions/replace/info/base/ITContent.java

@ -77,6 +77,23 @@ public class ITContent implements Cloneable {
*/
private int tag = -1;
/**
* 替换后内容
*/
private String afterReplaceStr;
/**
* 是否替换过
*/
private boolean replaced = false;
/**
*
*/
private String checkStr = StringUtils.EMPTY;
private boolean wrongful = false;
public ITContent() {
this.sheetID = StringUtils.EMPTY;
this.sheetName = StringUtils.EMPTY;
@ -92,6 +109,7 @@ public class ITContent implements Cloneable {
this.operatorArray = new ArrayList<>();
this.holdObject = new Object();
this.templatePath = StringUtils.EMPTY;
this.afterReplaceStr = StringUtils.EMPTY;
}
@ -102,7 +120,7 @@ public class ITContent implements Cloneable {
*/
public static ITContent copy(ITContent content) {
ITContent result = new ITContent();
if (content != null){
if (content != null) {
result.setSheetID(content.getSheetID());
result.setSheetName(content.getSheetName());
result.setTemplateName(content.getTemplateName());
@ -120,6 +138,9 @@ public class ITContent implements Cloneable {
result.setHoldObject(content.getHoldObject());
result.setTag(content.getTag());
result.setTemplatePath(content.getTemplatePath());
result.setAfterReplaceStr(content.getAfterReplaceStr());
result.setReplaced(content.isReplaced());
result.setWrongful(content.isWrongful());
}
return result;
}
@ -216,6 +237,38 @@ public class ITContent implements Cloneable {
this.templatePath = templatePath;
}
public String getAfterReplaceStr() {
return afterReplaceStr;
}
public void setAfterReplaceStr(String afterReplaceStr) {
this.afterReplaceStr = afterReplaceStr;
}
public boolean isReplaced() {
return replaced;
}
public void setReplaced(boolean replaced) {
this.replaced = replaced;
}
public String getCheckStr() {
return checkStr;
}
public void setCheckStr(String checkStr) {
this.checkStr = checkStr;
}
public boolean isWrongful() {
return wrongful;
}
public void setWrongful(boolean wrongful) {
this.wrongful = wrongful;
}
/**
* 添加位置信息
*

96
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITCheckDialog.java

@ -0,0 +1,96 @@
package com.fr.design.actions.replace.ui;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.i18n.Toolkit;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable;
/**
* 合法性校验的面板
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-28
*/
public class ITCheckDialog extends UIDialog {
private UITableEditorPane editorPane;
private ITCheckEditor editor;
private static final int DIALOG_WIDTH = 660, DIALOG_HEIGHT = 400;
private static final int TABLE_WIDTH = 640, TABLE_HEIGHT = 320;
private static final int LABEL_HEIGHT = 20;
public ITCheckDialog() {
super(ITReplaceMainDialog.getInstance());
setTitle(Toolkit.i18nText("Fine-Design_Replace_Check_Title"));
JPanel centerPanel = new JPanel();
JPanel southPanel = new JPanel();
southPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
editor = new ITCheckEditor();
editorPane = new UITableEditorPane(editor);
editor.add(ITReplaceMainDialog.getCheckValidList());
UILabel label = new UILabel("<html>" + Toolkit.i18nText("Fine-Design_Replace_Check") + "<font color = 'rgb(236,124,125)'>" + ITReplaceMainDialog.contentReplaceFailedCount + "</font>" + Toolkit.i18nText("Fine-Design_Replace_Check_Tip"));
JPanel center = new JPanel(new BorderLayout());
UIButton location = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Location"));
UIButton cancel = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
location.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for (int i : ITReplaceMainDialog.getSerialNumber()) {
getEditTable().addRowSelectionInterval(i, i);
}
ITCheckDialog.this.dispose();
}
});
cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ITCheckDialog.this.dispose();
}
});
editorPane.setPreferredSize(new Dimension(TABLE_WIDTH, TABLE_HEIGHT));
label.setPreferredSize(new Dimension(TABLE_WIDTH, LABEL_HEIGHT));
centerPanel.add(editorPane);
southPanel.add(location);
southPanel.add(cancel);
center.add(southPanel, BorderLayout.SOUTH);
center.add(label, BorderLayout.NORTH);
center.add(centerPanel, BorderLayout.CENTER);
center.setVisible(true);
//主体部分
add(center);
setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
setMaximumSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
setMinimumSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
setLocation(ITReplaceMainDialog.getInstance().getX() + ITReplaceMainDialog.getInstance().getWidth() / 2 - DIALOG_WIDTH / 2, ITReplaceMainDialog.getInstance().getY());
setVisible(true);
}
@Override
public void checkValid() throws Exception {
}
}

64
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITCheckEditor.java

@ -0,0 +1,64 @@
package com.fr.design.actions.replace.ui;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import com.fr.design.i18n.Toolkit;
import java.util.List;
/**
* 合法性校验表格的Model
*
* @author Destiny.Lin
* @version 11.0
* created by Destiny.Lin on 2022-10-28
*/
public class ITCheckEditor extends UITableModelAdapter {
public ITCheckEditor() {
super(new String[]{
Toolkit.i18nText("Fine-Design_Replace_Check_Content"),
Toolkit.i18nText("Fine-Design_Replace_Check_Reason")
});
this.setColumnClass(new Class[]{
UILabel.class,
UILabel.class,
});
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
ITContent content = (ITContent) this.getList().get(rowIndex);
if (columnIndex == 0) {
return content.getShowStr();
} else {
return content.getCheckStr();
}
}
@Override
public boolean isCellEditable(int row, int col) {
return false;
}
@Override
public UITableEditAction[] createAction() {
return new UITableEditAction[0];
}
/**
* 添加数据
*
* @param list
*/
public void add(List<? extends Info> list) {
for (Info info : list) {
addRow(info.getContent());
}
fireTableDataChanged();
}
}

392
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java

@ -3,6 +3,7 @@ package com.fr.design.actions.replace.ui;
import com.fr.design.actions.replace.action.ShowSearchResultAction;
import com.fr.design.actions.replace.action.setting.SettingController;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.utils.ShowValueUtils;
@ -15,6 +16,8 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import com.fr.design.mainframe.toast.ToastMsgDialog;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
@ -42,7 +45,10 @@ import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable;
* created by Destiny.Lin on 2022-08-10
*/
public class ITReplaceMainDialog extends UIDialog {
List<? extends Info> searchResultList = new ArrayList<>();
private static List<? extends Info> searchContentResultList = new ArrayList<>();
private static List<? extends Info> searchSettingResultList = new ArrayList<>();
private static List<Info> checkValidList = new ArrayList<>();
private static List<Integer> serialNumber = new ArrayList<>();
private static boolean ITReplaceFlag = false;
private static boolean matched = false;
private static volatile ITReplaceMainDialog instance = null;
@ -53,9 +59,19 @@ public class ITReplaceMainDialog extends UIDialog {
private ITReplaceWestPanel westPanel;
private boolean searchFlag;
private String searchStr;
private String settingInputStr;
private String settingExtraStr;
private static final int FIRST_ROW = 0;
private static final int NONE = 0;
public static int selectCount = 0;
public static int MAIN_PANEL_WIDTH = 929;
public static int replaceContentNum = 0;
public static int replaceSettingNum = 0;
public static int contentReplaceCount = 0;
public static int contentReplaceFailedCount = 0;
public static int settingReplaceCount = 0;
public static int settingReplaceFailedCount = 0;
public ITReplaceMainDialog() {
super(DesignerContext.getDesignerFrame());
@ -131,15 +147,14 @@ public class ITReplaceMainDialog extends UIDialog {
((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
search();
search4Content();
}
});
northPane.getSearchButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
search();
search4Content();
}
});
@ -147,11 +162,24 @@ public class ITReplaceMainDialog extends UIDialog {
@Override
public void actionPerformed(ActionEvent e) {
if (isSearchFlag()) {
replace();
replace4Content();
}
}
});
center.add(northPane.getScrollPane(), BorderLayout.NORTH);
northPane.getSearchSettingButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
search4Setting();
}
});
northPane.getReplaceSettingButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
replace4Setting();
}
});
center.add(ITReplaceNorthPanel.getCardPanel(), BorderLayout.NORTH);
center.add(southPanel.getTableEditorPane(), BorderLayout.CENTER);
add(westPanel.getLeftPanel(), BorderLayout.WEST);
//主体部分
@ -160,26 +188,18 @@ public class ITReplaceMainDialog extends UIDialog {
}
/**
* 替换
* 模板内容替换相关
*/
private void replace() {
private void replace4Content() {
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
String replaceStr = ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).getText();
//替换内容为空需要触发搜索
if (isITReplaceValid() && checkTemplateChanged(searchResultList)) {
if (StringUtils.equals(getSearchStr(), searchStr) && StringUtils.isNotEmpty(replaceStr)) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
for (Info info : searchResultList) {
if (info.getContent().isSelected()) {
info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray());
}
}
southPanel.getTableEditorPane().update();
northPane.refreshReplaceInputComboBoxItems();
ITTableEditorPane.getEditTable().repaint();
setSearchFlag(false);
clearContentCount();
if (isITReplaceValid() && checkTemplateChanged(searchContentResultList)) {
if (StringUtils.equals(getSearchStr(), searchStr)) {
checkLegalValiditySelector(searchStr, replaceStr);
} else {
search4Content();
}
search();
} else {
Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")};
int optionSelected = FineJOptionPane.showOptionDialog(
@ -187,7 +207,7 @@ public class ITReplaceMainDialog extends UIDialog {
Toolkit.i18nText("Fine-Design_Replace_Message"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.ERROR_MESSAGE,
JOptionPane.WARNING_MESSAGE,
null,
// 如果传null, 则按钮为 optionType 类型所表示的按钮(也就是确认对话框)
options,
@ -195,16 +215,105 @@ public class ITReplaceMainDialog extends UIDialog {
);
//如果选择了重新查找,则再查找一遍
if (optionSelected == 0) {
search();
search4Content();
}
}
}
/**
* 替换
*
* @param searchStr
* @param replaceStr
*/
public void replace(String searchStr, String replaceStr) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
for (Info info : searchContentResultList) {
if (!info.getContent().isWrongful()) {
info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray());
}
info.getContent().setReplaced(true);
}
northPane.getResultLabel().setText(ShowValueUtils.getResultTip(searchContentResultList.size(), contentReplaceCount, contentReplaceFailedCount));
southPanel.getTableEditorPane().update();
northPane.refreshReplaceInputComboBoxItems();
ITTableEditorPane.getEditTable().repaint();
}
/**
* 合法性校验选择器选择是否进行校验
*/
public void checkLegalValiditySelector(String searchStr, String replaceStr) {
Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Go_To_Check"), Toolkit.i18nText("Fine-Design_Replace_Direct")};
int optionSelected = FineJOptionPane.showOptionDialog(
ITReplaceMainDialog.this,
Toolkit.i18nText("Fine-Design_Replace_Legal"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE,
null,
// 如果传null, 则按钮为 optionType 类型所表示的按钮(也就是确认对话框)
options,
options[0]
);
//如果选择了直接替换,则直接执行替换
if (optionSelected == 1) {
updateCheckValidList();
replace(searchStr, replaceStr);
} else {
checkLegalValidity();
}
}
/**
* 检测
*/
public void checkLegalValidity() {
updateCheckValidList();
if (contentReplaceFailedCount == 0) {
ToastMsgDialog dialog = DesignerToastMsgUtil.createPromptDialog(Toolkit.i18nText("Fine-Design_Replace_Check_None"));
dialog.setVisible(true);
} else {
new ITCheckDialog();
}
}
private void updateCheckValidList() {
checkValidList.clear();
serialNumber.clear();
int count = 0;
String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText();
String replaceStr = ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).getText();
for (Info info : searchContentResultList) {
if (isAllow2Replace(info)) {
if (!info.isLegalValid(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(), searchStr, replaceStr)) {
contentReplaceFailedCount++;
checkValidList.add(info);
serialNumber.add(count);
info.getContent().setWrongful(true);
} else {
contentReplaceCount++;
}
count++;
}
}
}
/**
* 是否能够替换
*
* @param info 存储信息的数据结构
* @return 能则返回true
*/
private boolean isAllow2Replace(Info info) {
return info.getContent().isSelected() && !info.getContent().isReplaced();
}
private Boolean checkTemplateChanged(List<? extends Info> searchResultList) {
for (Info info : searchResultList) {
if (!info.checkValid()) {
if (!info.getContent().isReplaced() && !info.checkValid()) {
return false;
}
}
@ -281,10 +390,11 @@ public class ITReplaceMainDialog extends UIDialog {
}
/**
* 搜索
* 搜索模板内容
*/
public void search() {
public void search4Content() {
ITTableEditor itTableEditor = southPanel.getItTableEditor();
clearContentCount();
if (JTemplate.isValid(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())) {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
templateID = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget().getTemplateID();
@ -299,24 +409,25 @@ public class ITReplaceMainDialog extends UIDialog {
ShowSearchResultAction searchAction = ShowSearchResultAction.match(GeneralUtils.objectToString(northPane.getFindCombobox().getSelectedItem()));
//搜索
if (searchAction != null) {
searchResultList = searchAction.addMatchResult(searchStr, searchAction.showSearchValue(jTemplate));
itTableEditor.add(searchResultList);
northPane.getResultLabel().setText("<html>" + Toolkit.i18nText("Fine-Design_Replace_Search_Finish") + "<font color = 'rgb(61,153,249)'>" + searchResultList.size() + "</font>" + Toolkit.i18nText("Fine-Design_Replace_Result"));
searchContentResultList = searchAction.addMatchResult(searchStr, searchAction.showSearchValue(jTemplate));
itTableEditor.add(searchContentResultList);
northPane.getResultLabel().setText(ShowValueUtils.getResultTip(searchContentResultList.size(), contentReplaceCount, contentReplaceFailedCount));
}
replaceContentNum = 0;
ITTableEditorPane.ITHeaderRenderer renderer = (ITTableEditorPane.ITHeaderRenderer) getEditTable().getTableHeader().getDefaultRenderer();
//刷新表头,并且重新勾选中表头全选框
renderer.refreshHeader(getEditTable(), true);
itTableEditor.fireTableDataChanged();
northPane.refreshFindInputComboBoxItems();
setSearchFlag(true);
selectCount = searchResultList.size();
selectCount = searchContentResultList.size();
//如果有结果,默认选中第一行
if (searchResultList.size() > 0) {
if (searchContentResultList.size() > 0) {
getEditTable().addRowSelectionInterval(FIRST_ROW, FIRST_ROW);
}
//更新替换按钮可用性
if (StringUtils.isEmpty(searchStr) || searchResultList.size() == 0) {
if (StringUtils.isEmpty(searchStr) || searchContentResultList.size() == 0) {
northPane.getReplaceButton().setEnabled(false);
} else {
northPane.getReplaceButton().setEnabled(true);
@ -330,6 +441,126 @@ public class ITReplaceMainDialog extends UIDialog {
}
/**
* 搜索设置项
*/
public void search4Setting() {
ITTableEditor settingEditor = southPanel.getItTableEditor();
templateID = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget().getTemplateID();
templateName = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTemplateName();
clearSettingCount();
if (JTemplate.isValid(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())) {
String firstStr = GeneralUtils.objectToString(northPane.getFindSettingComboBox().getSelectedItem());
String secondStr = GeneralUtils.objectToString(northPane.getFindSettingInputComboBox().getSelectedItem());
String thirdStr = GeneralUtils.objectToString(northPane.getFindExtraSettingComboBox().getSelectedItem());
setSettingInputStr(secondStr);
setSettingExtraStr(thirdStr);
SettingController controller = SettingController.match(firstStr);
if (controller != null) {
searchSettingResultList = controller.addMatchResult(controller.showSearchValue(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()), secondStr, thirdStr);
settingEditor.clear();
settingEditor.add(searchSettingResultList);
ITTableEditorPane.ITHeaderRenderer renderer = (ITTableEditorPane.ITHeaderRenderer) getEditTable().getTableHeader().getDefaultRenderer();
renderer.refreshHeader(getEditTable(), true);
settingEditor.fireTableDataChanged();
}
//如果有结果,默认选中第一行
if (searchSettingResultList.size() > 0) {
getEditTable().addRowSelectionInterval(FIRST_ROW, FIRST_ROW);
}
northPane.getSettingResultLabel().setText(ShowValueUtils.getResultTip(searchSettingResultList.size(), settingReplaceCount, settingReplaceFailedCount));
}
}
/**
* 替换设置项
*/
public void replace4Setting() {
String firstStr = GeneralUtils.objectToString(northPane.getFindSettingComboBox().getSelectedItem());
String inputStr = GeneralUtils.objectToString(northPane.getFindSettingInputComboBox().getSelectedItem());
String extraStr = GeneralUtils.objectToString(northPane.getFindExtraSettingComboBox().getSelectedItem());
clearSettingCount();
if (isITReplaceValid() && !isSettingEverChanged(searchSettingResultList, firstStr, inputStr, extraStr)) {
if (isInputStrValid(inputStr, extraStr)) {
String secondStr = GeneralUtils.objectToString(northPane.getReplaceSettingInputComboBox().getSelectedItem());
String thirdStr = GeneralUtils.objectToString(northPane.getReplaceExtraSettingComboBox().getSelectedItem());
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(true);
for (Info info : searchSettingResultList) {
if (info.getContent().isSelected()) {
SettingController controller = SettingController.match(firstStr);
if (controller != null) {
controller.replace(info, secondStr, thirdStr);
info.getContent().setReplaced(true);
settingReplaceCount++;
}
}
}
northPane.getSettingResultLabel().setText(ShowValueUtils.getResultTip(searchSettingResultList.size(), settingReplaceCount, settingReplaceFailedCount));
southPanel.getTableEditorPane().update();
ITTableEditorPane.getEditTable().repaint();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
} else {
search4Setting();
}
} else {
Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Replace_Search_Again"), Toolkit.i18nText("Fine-Design_Basic_Cancel")};
int optionSelected = FineJOptionPane.showOptionDialog(
ITReplaceMainDialog.this,
Toolkit.i18nText("Fine-Design_Replace_Message"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE,
null,
// 如果传null, 则按钮为 optionType 类型所表示的按钮(也就是确认对话框)
options,
options[0]
);
//如果选择了重新查找,则再查找一遍
if (isSelectSearch(optionSelected)) {
search4Setting();
}
}
}
private boolean isSelectSearch(int optionSelected) {
return optionSelected == NONE;
}
/**
* 用户的输入是否更改
*
* @param inputStr 用户的一级输入框
* @param extraStr 用户的二级输入框
* @return 没更改过返回true
*/
public boolean isInputStrValid(String inputStr, String extraStr) {
return StringUtils.equals(inputStr, getSettingInputStr()) && StringUtils.equals(extraStr, getSettingExtraStr());
}
/**
* 设置项的内容是否更改过
*
* @param searchSettingResultList 数据
* @param controllerMatch controller的类型
* @param inputStr 用户的一级输入框
* @param extraStr 用户的二级输入框
* @return 更改过返回true
*/
public boolean isSettingEverChanged(List<? extends Info> searchSettingResultList, String controllerMatch, String inputStr, String extraStr) {
for (Info info : searchSettingResultList) {
if (info.getContent().isSelected() && !info.getContent().isReplaced()) {
SettingController controller = SettingController.match(controllerMatch);
if (controller != null && controller.isEverChanged(info, inputStr, extraStr)) {
return true;
}
}
}
return false;
}
public ITReplaceSouthPanel getSouthPanel() {
return southPanel;
}
@ -346,10 +577,105 @@ public class ITReplaceMainDialog extends UIDialog {
this.northPane = northPane;
}
public String getSettingInputStr() {
return settingInputStr;
}
public void setSettingInputStr(String settingInputStr) {
this.settingInputStr = settingInputStr;
}
public String getSettingExtraStr() {
return settingExtraStr;
}
public void setSettingExtraStr(String settingExtraStr) {
this.settingExtraStr = settingExtraStr;
}
/**
* 获取不合法的序号
*
* @return 不合法的元素的序号列表
*/
public static List<Integer> getSerialNumber() {
return serialNumber;
}
/**
* 检测结果是否合法
*/
@Override
public void checkValid() throws Exception {
}
/**
* 获取模板内容数据
*
* @return 存储数据的list
*/
public static List<? extends Info> getSearchContentResultList() {
return searchContentResultList;
}
/**
* 设置模板内容数据
*
* @param searchContentResultList 模板内容表格的数据
*/
public static void setSearchContentResultList(List<? extends Info> searchContentResultList) {
ITReplaceMainDialog.searchContentResultList = searchContentResultList;
}
/**
* 获取设置项数据
*
* @return 存储数据的list
*/
public static List<? extends Info> getSearchSettingResultList() {
return searchSettingResultList;
}
/**
* 设置设置项的数据
*
* @param searchSettingResultList 设置项表格的数据
*/
public static void setSearchSettingResultList(List<? extends Info> searchSettingResultList) {
ITReplaceMainDialog.searchSettingResultList = searchSettingResultList;
}
/**
* 获取检测的列表
*
* @return
*/
public static List<Info> getCheckValidList() {
return checkValidList;
}
/**
* 设置检测列表
*
* @param checkValidList
*/
public static void setCheckValidList(List<Info> checkValidList) {
ITReplaceMainDialog.checkValidList = checkValidList;
}
/**
* 重置计数
*/
public void clearContentCount() {
contentReplaceCount = NONE;
contentReplaceFailedCount = NONE;
}
/**
* 重置计数
*/
public void clearSettingCount() {
settingReplaceCount = NONE;
settingReplaceFailedCount = NONE;
}
}

453
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java

@ -1,12 +1,16 @@
package com.fr.design.actions.replace.ui;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.replace.action.setting.SettingContent;
import com.fr.design.actions.replace.action.setting.SettingController;
import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
@ -16,11 +20,15 @@ import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* 上面板
@ -30,7 +38,12 @@ import java.util.Collections;
* created by Destiny.Lin on 2022-09-01
*/
public class ITReplaceNorthPanel {
private JPanel upPanel;
private JPanel upContentPanel;
private JPanel upSettingPanel;
private static JPanel cardPanel;
private static CardLayout cardLayout;
//content
private UILabel findLabel;
private UILabel rangeLabel;
private UILabel resultLabel;
@ -38,12 +51,28 @@ public class ITReplaceNorthPanel {
private UIComboBox rangeCombobox;
private JCheckBox matchRadioButton;
private UILabel iconLabel;
private UIComboBox findInputCombobox;
private UIComboBox replaceInputCombobox;
private UIScrollPane scrollPane;
private UIScrollPane contentScrollPane;
private UIScrollPane settingScrollPane;
private UIButton replaceButton;
private UIButton searchButton;
//setting
private UILabel iconSettingLabel;
private UILabel findSettingLabel;
private UILabel rangeSettingLabel;
private UILabel settingResultLabel;
private UIComboBox rangeSettingComboBox;
private UIComboBox findSettingComboBox;
private UIComboBox findSettingInputComboBox;
private UIComboBox replaceSettingInputComboBox;
private UIComboBox findExtraSettingComboBox;
private UIComboBox replaceExtraSettingComboBox;
private TableDataComboBox tableDataComboBox;
private UIButton replaceSettingButton;
private UIButton searchSettingButton;
private static double rate = 1.00;
//存储的5次最近输入
@ -59,6 +88,10 @@ public class ITReplaceNorthPanel {
private static final int FIRST_X = 20, SECOND_X = 80;
private static final int LABEL_WIDTH = 60;
private static final Icon CHANGE_ICON = IconUtils.readIcon("/com/fr/design/images/replace/change_normal.svg");
private static final String[] RANGE_ITEMS = new String[]{Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")};
public static final String CARD_CONTENT = "Content";
public static final String CARD_SETTING = "setting";
private int findLabelX, findLabelY, findLabelWidth, findLabelHeight;
@ -74,9 +107,14 @@ public class ITReplaceNorthPanel {
private int iconX, iconY, iconWidth, iconHeight;
private int inputLength;
public static ArrayList<String> findItems = new ArrayList<>();
public static ArrayList<String> findInputItems = new ArrayList<>();
public static ArrayList<String> replaceInputItems = new ArrayList<>();
public static List<String> findItems = new ArrayList<>();
public static List<String> findSettingItems = new ArrayList<>();
public static List<String> findInputItems = new ArrayList<>();
public static List<String> replaceInputItems = new ArrayList<>();
public static List<String> formatItems = new ArrayList<>();
public static List<String> digitItems = new ArrayList<>();
public static List<String> groupItems = new ArrayList<>();
public static List<String> dsColumnItems = new ArrayList<>();
static {
findItems.add(Toolkit.i18nText("Fine-Design_Basic_Cell"));
@ -86,20 +124,69 @@ public class ITReplaceNorthPanel {
findItems.add(Toolkit.i18nText("Fine-Design_Replace_Component"));
findItems.add(Toolkit.i18nText("Fine-Design_Basic_Widget"));
findItems.add(Toolkit.i18nText("Fine-Design_Basic_Formula"));
findSettingItems.add(SettingContent.CELL_FORMAT_NAME);
findSettingItems.add(SettingContent.CELL_DATA_SETTING_NAME);
findSettingItems.add(SettingContent.CELL_DS_COLUMN_NAME);
findSettingItems.add(SettingContent.DATASOURCE_CONNECTION_NAME);
findSettingItems.add(SettingContent.DATASOURCE_COLLECT_NAME);
formatItems.add(SettingContent.FORMAT_COMMON);
formatItems.add(SettingContent.FORMAT_NUMBER);
formatItems.add(SettingContent.FORMAT_MONEY);
formatItems.add(SettingContent.FORMAT_PERCENT);
formatItems.add(SettingContent.FORMAT_PERMILLAGE);
formatItems.add(SettingContent.FORMAT_SCIENCE);
formatItems.add(SettingContent.FORMAT_DATE);
formatItems.add(SettingContent.FORMAT_TIME);
formatItems.add(SettingContent.FORMAT_TEXT);
digitItems.add(SettingContent.DIGIT_SETTING_GROUP);
digitItems.add(SettingContent.DIGIT_SETTING_LIST);
digitItems.add(SettingContent.DIGIT_SETTING_SUM);
groupItems.add(SettingContent.GROUP_COMMON);
groupItems.add(SettingContent.GROUP_CONTINUUM);
dsColumnItems.add(SettingContent.CONNECTION_TEMPLATE);
}
public ITReplaceNorthPanel() {
upPanel = new JPanel(null);
cardLayout = new CardLayout();
cardPanel = new JPanel(cardLayout);
upContentPanel = new JPanel(null);
upSettingPanel = new JPanel(null);
initContentPanel();
initSettingPanel();
cardPanel.add(contentScrollPane, CARD_CONTENT);
cardPanel.add(settingScrollPane, CARD_SETTING);
}
/**
* 限制尺寸
*
* @param width
*/
public void setLimitSize(int width) {
upContentPanel.setMaximumSize(new Dimension(limit_width, HEIGHT));
upContentPanel.setPreferredSize(new Dimension(limit_width, HEIGHT));
}
/**
* 初始化模板内容查找面板
*/
public void initContentPanel() {
findLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Element"));
rangeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Range"));
iconLabel = new UILabel(CHANGE_ICON);
resultLabel = new UILabel();
String[] rangeItems = new String[]{Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Current")};
String[] replaceInputItems = new String[]{StringUtils.EMPTY};
findCombobox = new UIComboBox(findItems.toArray());
rangeCombobox = new UIComboBox(rangeItems);
rangeCombobox = new UIComboBox(RANGE_ITEMS);
findInputCombobox = new UIComboBox(findInputItems.toArray()) {
@Override
public void setEditor(ComboBoxEditor comboBoxEditor) {
@ -122,32 +209,198 @@ public class ITReplaceNorthPanel {
replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button"));
searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button"));
upPanel.setPreferredSize(new Dimension(limit_width, HEIGHT));
scrollPane = new UIScrollPane(upPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
upPanel.add(findLabel);
upPanel.add(rangeLabel);
upPanel.add(resultLabel);
upPanel.add(findCombobox);
upPanel.add(rangeCombobox);
upPanel.add(findInputCombobox);
upPanel.add(replaceInputCombobox);
upPanel.add(matchRadioButton);
upPanel.add(replaceButton);
upPanel.add(searchButton);
upPanel.add(iconLabel);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
upContentPanel.setPreferredSize(new Dimension(limit_width, HEIGHT));
contentScrollPane = new UIScrollPane(upContentPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
upContentPanel.add(findLabel);
upContentPanel.add(rangeLabel);
upContentPanel.add(resultLabel);
upContentPanel.add(findCombobox);
upContentPanel.add(rangeCombobox);
upContentPanel.add(findInputCombobox);
upContentPanel.add(replaceInputCombobox);
upContentPanel.add(matchRadioButton);
upContentPanel.add(replaceButton);
upContentPanel.add(searchButton);
upContentPanel.add(iconLabel);
contentScrollPane.setBorder(BorderFactory.createEmptyBorder());
}
/**
* 限制尺寸
* 初始化设置项查找面板
*/
public void initSettingPanel() {
findSettingLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Element"));
rangeSettingLabel = new UILabel(Toolkit.i18nText("Fine-Design_Replace_Search_Range"));
settingResultLabel = new UILabel();
findSettingComboBox = new UIComboBox(findSettingItems.toArray());
rangeSettingComboBox = new UIComboBox(RANGE_ITEMS);
findSettingInputComboBox = new UIComboBox(formatItems.toArray()) {
@Override
public void setEditor(ComboBoxEditor anEditor) {
super.setEditor(new ITComboBoxEditor());
}
};
findSettingInputComboBox.setSelectedIndex(-1);
replaceSettingInputComboBox = new UIComboBox(formatItems.toArray()) {
@Override
public void setEditor(ComboBoxEditor anEditor) {
super.setEditor(new ITComboBoxEditor());
}
};
replaceSettingInputComboBox.setSelectedIndex(-1);
((UITextField) (findSettingInputComboBox.getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Choose_Search") + SettingContent.CELL_FORMAT_NAME);
findSettingInputComboBox.setEditable(true);
((UITextField) (findSettingInputComboBox.getEditor().getEditorComponent())).setEditable(false);
((UITextField) (replaceSettingInputComboBox.getEditor().getEditorComponent())).setPlaceholder(Toolkit.i18nText("Fine-Design_Replace_Choose_Replace") + SettingContent.CELL_FORMAT_NAME);
replaceSettingInputComboBox.setEditable(true);
((UITextField) (replaceSettingInputComboBox.getEditor().getEditorComponent())).setEditable(false);
iconSettingLabel = new UILabel(CHANGE_ICON);
findExtraSettingComboBox = new UIComboBox(groupItems.toArray());
findExtraSettingComboBox.setVisible(false);
replaceExtraSettingComboBox = new UIComboBox(groupItems.toArray());
replaceExtraSettingComboBox.setVisible(false);
searchSettingButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button"));
replaceSettingButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button"));
replaceSettingButton.setEnabled(false);
upSettingPanel.setPreferredSize(new Dimension(limit_width, HEIGHT));
upSettingPanel.add(findSettingLabel);
upSettingPanel.add(rangeSettingLabel);
upSettingPanel.add(findSettingComboBox);
upSettingPanel.add(rangeSettingComboBox);
upSettingPanel.add(findSettingInputComboBox);
upSettingPanel.add(replaceSettingInputComboBox);
upSettingPanel.add(iconSettingLabel);
upSettingPanel.add(findExtraSettingComboBox);
upSettingPanel.add(replaceExtraSettingComboBox);
upSettingPanel.add(searchSettingButton);
upSettingPanel.add(replaceSettingButton);
upSettingPanel.add(settingResultLabel);
settingScrollPane = new UIScrollPane(upSettingPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
settingScrollPane.setBorder(BorderFactory.createEmptyBorder());
initListener();
}
/**
* 初始化事件
*/
private void initListener() {
findSettingComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
replaceSettingInputComboBox.clearBoxItems();
findSettingInputComboBox.clearBoxItems();
String str = GeneralUtils.objectToString(findSettingComboBox.getSelectedItem());
((UITextField) findSettingInputComboBox.getEditor().getEditorComponent()).setText(StringUtils.EMPTY);
refreshSettingComboBox(SettingController.getSettingRefreshItems(str));
setDataSourceComboBoxStatus(isAllow2Replace());
replaceSettingButton.setEnabled(false);
}
});
findSettingInputComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
refreshExtraComboBox(findSettingInputComboBox, findExtraSettingComboBox);
}
});
replaceSettingInputComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
refreshExtraComboBox(replaceSettingInputComboBox, replaceExtraSettingComboBox);
}
});
}
/**
* 刷新替换按钮状态
*/
public void refreshSettingReplaceButtonStatus() {
replaceSettingButton.setEnabled(isAllChoose());
}
/**
* 是否各个选项都有选中内容
*
* @param width
* @return 是则返回true
*/
public void setLimitSize(int width) {
upPanel.setMaximumSize(new Dimension(limit_width, 161));
upPanel.setPreferredSize(new Dimension(limit_width, 161));
public boolean isAllChoose() {
String str = GeneralUtils.objectToString(findSettingComboBox.getSelectedItem());
String findInputStr = GeneralUtils.objectToString(findSettingInputComboBox.getSelectedItem());
String replaceInputStr = GeneralUtils.objectToString(replaceSettingInputComboBox.getSelectedItem());
String findExtraStr = GeneralUtils.objectToString(findExtraSettingComboBox.getSelectedItem());
String replaceExtraStr = GeneralUtils.objectToString(replaceExtraSettingComboBox.getSelectedItem());
return (!StringUtils.equals(str, SettingContent.DATASOURCE_COLLECT_NAME) && !StringUtils.equals(str, SettingContent.DATASOURCE_CONNECTION_NAME))
&& StringUtils.isNotEmpty(findInputStr)
&& StringUtils.isNotEmpty(replaceInputStr)
&& StringUtils.isNotEmpty(findExtraStr)
&& StringUtils.isNotEmpty(replaceExtraStr);
}
/**
* 是否支持替换
*
* @return 支持返回true
*/
public boolean isAllow2Replace() {
String str = GeneralUtils.objectToString(findSettingComboBox.getSelectedItem());
return !StringUtils.equals(str, SettingContent.DATASOURCE_CONNECTION_NAME) && !StringUtils.equals(str, SettingContent.DATASOURCE_COLLECT_NAME);
}
/**
* 设置数据集相关情况下的替换框的状态
*
* @param status
*/
public void setDataSourceComboBoxStatus(boolean status) {
replaceSettingButton.setEnabled(status);
replaceSettingInputComboBox.setEnabled(status);
replaceExtraSettingComboBox.setEnabled(status);
}
/**
* 刷新延展出的下拉框第三层
*
* @param settingComboBox
* @param extraComboBox
*/
public void refreshExtraComboBox(UIComboBox settingComboBox, UIComboBox extraComboBox) {
String str = GeneralUtils.objectToString(findSettingComboBox.getSelectedItem());
String parent = GeneralUtils.objectToString(settingComboBox.getSelectedItem());
if (StringUtils.isNotEmpty(parent) && SettingController.match(str) != null && SettingController.match(str).hasExpand(str, parent)) {
extraComboBox.clearBoxItems();
extraComboBox.setVisible(true);
extraComboBox.refreshBoxItems(SettingController.getSettingExtraRefreshItems(str, parent));
extraComboBox.setSelectedIndex(0);
} else {
extraComboBox.setVisible(false);
}
refreshSettingReplaceButtonStatus();
}
/**
* 刷新用户选择的输入框第二层
*
* @param list
*/
public void refreshSettingComboBox(List<String> list) {
findSettingInputComboBox.clearBoxItems();
findSettingInputComboBox.refreshBoxItems(list);
replaceSettingInputComboBox.clearBoxItems();
replaceSettingInputComboBox.refreshBoxItems(list);
replaceExtraSettingComboBox.setVisible(false);
findExtraSettingComboBox.setVisible(false);
}
/**
* 适配屏幕
@ -162,7 +415,50 @@ public class ITReplaceNorthPanel {
templateWidth = templateWidth - ITReplaceWestPanel.LEFT_WIDTH;
inputLength = (templateWidth - GAP * 5) / 2;
fitContentScreen(templateWidth);
fitSettingScreen(templateWidth);
}
/**
* 适配屏幕
*
* @param templateWidth 当前设计器宽度
*/
private void fitSettingScreen(int templateWidth) {
findSettingLabel.setBounds(FIRST_X, FIRST_Y, LABEL_WIDTH, COMPONENT_HEIGHT);
findSettingComboBox.setBounds(SECOND_X, FIRST_Y, inputLength - 4 * GAP, COMPONENT_HEIGHT);
rangeSettingLabel.setBounds(replaceInputComboBoxX, FIRST_Y, LABEL_WIDTH, COMPONENT_HEIGHT);
rangeSettingComboBox.setBounds(rangeLabelX + rangeLabelWidth, FIRST_Y, inputLength - 3 * GAP, COMPONENT_HEIGHT);
findSettingInputComboBox.setBounds(FIRST_X, SECOND_Y, inputLength - GAP, COMPONENT_HEIGHT);
replaceSettingInputComboBox.setBounds(templateWidth - inputLength - GAP * 2, SECOND_Y, inputLength, COMPONENT_HEIGHT);
iconSettingLabel.setBounds(iconX, iconY, iconWidth, iconHeight);
searchSettingButton.setBounds(searchButtonX, searchButtonY, BUTTON_WIDTH, searchButtonHeight);
replaceSettingButton.setBounds(replaceButtonX, replaceButtonY, BUTTON_WIDTH, replaceButtonHeight);
settingResultLabel.setBounds(resultLabelX, resultLabelY, resultLabelWidth, resultLabelHeight);
setExtraBounds(templateWidth);
}
/**
* 设置额外的输入框
*
* @param templateWidth 当前设计器宽度
*/
private void setExtraBounds(int templateWidth) {
findExtraSettingComboBox.setBounds(FIRST_X, THIRD_Y, inputLength - GAP, COMPONENT_HEIGHT);
replaceExtraSettingComboBox.setBounds(templateWidth - inputLength - GAP * 2, THIRD_Y, inputLength, COMPONENT_HEIGHT);
}
/**
* 模板内容查找面板适配屏幕
*
* @param templateWidth 当前设计器宽度
*/
private void fitContentScreen(int templateWidth) {
setFindLabelBounds();
setResultLabelBounds(templateWidth);
setFindComboboxBounds();
@ -174,7 +470,6 @@ public class ITReplaceNorthPanel {
setReplaceButtonBounds();
setSearchButtonBounds();
setIconLabelBounds();
}
@ -221,12 +516,12 @@ public class ITReplaceNorthPanel {
}
public UIScrollPane getScrollPane() {
return scrollPane;
public UIScrollPane getContentScrollPane() {
return contentScrollPane;
}
public void setScrollPane(UIScrollPane scrollPane) {
this.scrollPane = scrollPane;
public void setContentScrollPane(UIScrollPane contentScrollPane) {
this.contentScrollPane = contentScrollPane;
}
private void setIconLabelBounds() {
@ -320,12 +615,12 @@ public class ITReplaceNorthPanel {
findLabel.setBounds(findLabelX, findLabelY, findLabelWidth, findLabelHeight);
}
public JPanel getUpPanel() {
return upPanel;
public JPanel getUpContentPanel() {
return upContentPanel;
}
public void setUpPanel(JPanel upPanel) {
this.upPanel = upPanel;
public void setUpContentPanel(JPanel upContentPanel) {
this.upContentPanel = upContentPanel;
}
public UILabel getFindLabel() {
@ -407,4 +702,86 @@ public class ITReplaceNorthPanel {
public void setSearchButton(UIButton searchButton) {
this.searchButton = searchButton;
}
/**
* 获取CardLayout
* @return CardLayout
*/
public static CardLayout getCardLayout() {
return cardLayout;
}
/**
* 获取表格主界面
*
* @return cardPanel
*/
public static JPanel getCardPanel() {
return cardPanel;
}
public UIButton getReplaceSettingButton() {
return replaceSettingButton;
}
public void setReplaceSettingButton(UIButton replaceSettingButton) {
this.replaceSettingButton = replaceSettingButton;
}
public UIButton getSearchSettingButton() {
return searchSettingButton;
}
public void setSearchSettingButton(UIButton searchSettingButton) {
this.searchSettingButton = searchSettingButton;
}
public UIComboBox getFindSettingInputComboBox() {
return findSettingInputComboBox;
}
public void setFindSettingInputComboBox(UIComboBox findSettingInputComboBox) {
this.findSettingInputComboBox = findSettingInputComboBox;
}
public UIComboBox getReplaceSettingInputComboBox() {
return replaceSettingInputComboBox;
}
public void setReplaceSettingInputComboBox(UIComboBox replaceSettingInputComboBox) {
this.replaceSettingInputComboBox = replaceSettingInputComboBox;
}
public UIComboBox getFindExtraSettingComboBox() {
return findExtraSettingComboBox;
}
public void setFindExtraSettingComboBox(UIComboBox findExtraSettingComboBox) {
this.findExtraSettingComboBox = findExtraSettingComboBox;
}
public UIComboBox getReplaceExtraSettingComboBox() {
return replaceExtraSettingComboBox;
}
public void setReplaceExtraSettingComboBox(UIComboBox replaceExtraSettingComboBox) {
this.replaceExtraSettingComboBox = replaceExtraSettingComboBox;
}
public UIComboBox getFindSettingComboBox() {
return findSettingComboBox;
}
public void setFindSettingComboBox(UIComboBox findSettingComboBox) {
this.findSettingComboBox = findSettingComboBox;
}
public UILabel getSettingResultLabel() {
return settingResultLabel;
}
public void setSettingResultLabel(UILabel settingResultLabel) {
this.settingResultLabel = settingResultLabel;
}
}

20
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java

@ -14,11 +14,11 @@ import java.awt.Color;
*/
public class ITReplaceSouthPanel {
ITTableEditorPane tableEditorPane;
ITTableEditor itTableEditor;
private static ITTableEditor itTableEditor;
//勾选框索引
public static final int CHECKBOX_INDEX = 0;
//ITContent在表格的列索引
public static final int CONTENT_INDEX = 6;
public static final int CONTENT_INDEX = 7;
public static final int TABLE_GAP = 20;
public ITReplaceSouthPanel() {
@ -47,11 +47,21 @@ public class ITReplaceSouthPanel {
this.tableEditorPane = tableEditorPane;
}
public ITTableEditor getItTableEditor() {
/**
* 获取表格的editor
*
* @return 表格的editor
*/
public static ITTableEditor getItTableEditor() {
return itTableEditor;
}
public void setItTableEditor(ITTableEditor itTableEditor) {
this.itTableEditor = itTableEditor;
/**
* 设置表格的editor可用于刷新表格的数据
*
* @param itTableEditor 表格的editor
*/
public static void setItTableEditor(ITTableEditor itTableEditor) {
ITReplaceSouthPanel.itTableEditor = itTableEditor;
}
}

62
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java

@ -1,6 +1,7 @@
package com.fr.design.actions.replace.ui;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
@ -19,6 +20,7 @@ import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.util.List;
/**
* 左侧面板
@ -30,33 +32,59 @@ import java.awt.event.MouseEvent;
public class ITReplaceWestPanel {
private JPanel leftPanel;
private UILabel iconLabel;
private UIToggleButton contentButton;
private UIToggleButton settingButton;
private static final Icon HELP_ICON = IconUtils.readIcon("com/fr/design/images/buttonicon/replace_help.svg");
private static final String HELP_URL = CloudCenter.getInstance().acquireUrlByKind("design.replace.help", "https://help.fanruan.com/finereport/doc-view-4954.html?source=3");
private static final int FILL_COUNT = 12;
private static final int FILL_COUNT = 11;
public static final int LEFT_WIDTH = 100;
public static final String CONTENT_TEXT = "<html><font color = 'rgb(255,255,255)'>" + Toolkit.i18nText("Fine-Design_Basic_Templates_Content") + "</font></html>";
public static final String SETTING_TEXT = "<html><font color = 'rgb(255,255,255)'>" + Toolkit.i18nText("Fine-Design_Replace_Setting") + "</font></html>";
public ITReplaceWestPanel() {
leftPanel = new JPanel(new GridLayout(15, 1, 0, 0));
iconLabel = new UILabel("<html><u><font color = 'rgb(61,153,249)'>" + Toolkit.i18nText("Fine-Design_Report_Community_Help") + "</font></u></html>");
UIToggleButton contentButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Basic_Templates_Content"));
contentButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Basic_Templates_Content"));
settingButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Replace_Setting"));
contentButton.setText(CONTENT_TEXT);
contentButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!contentButton.isSelected()) {
contentButton.setText(CONTENT_TEXT);
showSelectPanel(ITReplaceNorthPanel.CARD_CONTENT, ITReplaceMainDialog.getSearchContentResultList());
} else {
contentButton.setText(Toolkit.i18nText("Fine-Design_Basic_Templates_Content"));
showSelectPanel(ITReplaceNorthPanel.CARD_SETTING, ITReplaceMainDialog.getSearchSettingResultList());
}
changeColor4SelectContent();
settingButton.setSelected(contentButton.isSelected());
}
});
settingButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!settingButton.isSelected()) {
showSelectPanel(ITReplaceNorthPanel.CARD_SETTING, ITReplaceMainDialog.getSearchSettingResultList());
} else {
showSelectPanel(ITReplaceNorthPanel.CARD_CONTENT, ITReplaceMainDialog.getSearchContentResultList());
}
changeColor4SelectContent();
contentButton.setSelected(settingButton.isSelected());
}
});
leftPanel.setBackground(Color.WHITE);
//默认选中模板内容
contentButton.setSelected(true);
settingButton.setSelected(false);
//去除按钮的边框
contentButton.setBorderPainted(false);
settingButton.setBorderPainted(false);
leftPanel.add(contentButton);
leftPanel.add(settingButton);
leftPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, new Color(218, 218, 221)));
//填充一下面板
for (int i = 0; i < FILL_COUNT; i++) {
@ -85,4 +113,30 @@ public class ITReplaceWestPanel {
public void setLeftPanel(JPanel leftPanel) {
this.leftPanel = leftPanel;
}
/**
* 切换面板时改变颜色
*/
public void changeColor4SelectContent() {
if (!contentButton.isSelected()) {
contentButton.setText(CONTENT_TEXT);
settingButton.setText(Toolkit.i18nText("Fine-Design_Replace_Setting"));
} else {
contentButton.setText(Toolkit.i18nText("Fine-Design_Basic_Templates_Content"));
settingButton.setText(SETTING_TEXT);
}
}
/**
* 展示指定的面板
*
* @param str card面板的标签
* @param list 对应的表格数据
*/
public void showSelectPanel(String str, List<? extends Info> list) {
ITReplaceNorthPanel.getCardLayout().show(ITReplaceNorthPanel.getCardPanel(), str);
ITReplaceSouthPanel.getItTableEditor().clear();
ITReplaceSouthPanel.getItTableEditor().add(list);
ITReplaceSouthPanel.getItTableEditor().fireTableDataChanged();
}
}

7
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

@ -13,7 +13,6 @@ import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;
@ -42,7 +41,7 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
paraButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ITContent content = (ITContent) getEditTable().getValueAt(getEditTable().getEditingRow(), 6);
ITContent content = (ITContent) getEditTable().getValueAt(getEditTable().getEditingRow(), ITReplaceSouthPanel.CONTENT_INDEX);
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true);
TRL trl = new TRL(GeneralUtils.objectToString(content.getTrlString()));
@ -67,7 +66,7 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
*/
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
ITContent content = (ITContent) table.getValueAt(row, 6);
ITContent content = (ITContent) table.getValueAt(row, ITReplaceSouthPanel.CONTENT_INDEX);
paraButton.setEnabled(content.isJumpAble());
return paraButton;
}
@ -85,7 +84,7 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
*/
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
ITContent content = (ITContent) table.getValueAt(row, 6);
ITContent content = (ITContent) table.getValueAt(row, ITReplaceSouthPanel.CONTENT_INDEX);
paraButton.setEnabled(content.isJumpAble());
return paraButton;
}

77
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java

@ -3,6 +3,7 @@ package com.fr.design.actions.replace.ui;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
@ -12,6 +13,14 @@ import com.fr.stable.StringUtils;
import org.jetbrains.annotations.Nullable;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.plaf.UIResource;
import javax.swing.table.TableCellRenderer;
import java.awt.Color;
import java.awt.Component;
import java.util.List;
/**
@ -28,6 +37,7 @@ public class ITTableEditor extends UITableModelAdapter {
super(new String[]{
StringUtils.BLANK,
Toolkit.i18nText("Fine-Design_Replace_Search_Content"),
Toolkit.i18nText("Fine-Design_After_Replace"),
Toolkit.i18nText("Fine-Design_Replace_Template_Name"),
Toolkit.i18nText("Fine-Design_Replace_Sheet_Name"),
Toolkit.i18nText("Fine-Design_Replace_Block_Name"),
@ -42,11 +52,14 @@ public class ITTableEditor extends UITableModelAdapter {
UILabel.class,
UILabel.class,
UILabel.class,
UILabel.class,
ITTableButton.class,
});
this.setDefaultEditor(ITTableButton.class, new ITTableButton());
this.setDefaultRenderer(ITTableButton.class, new ITTableButton());
this.setDefaultEditor(Boolean.class, new ITBooleanEditor());
this.setDefaultRenderer(Boolean.class, new ITBooleanRenderer());
this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CONTENT_INDEX).setMaxWidth(50);
this.createTable().getColumnModel().getColumn(ITReplaceSouthPanel.CHECKBOX_INDEX).setMaxWidth(50);
@ -106,6 +119,9 @@ public class ITTableEditor extends UITableModelAdapter {
fireTableDataChanged();
}
/**
* 选择的索引
*/
public enum ChooseIndex {
/**
* 第一列返回选中情况
@ -127,9 +143,18 @@ public class ITTableEditor extends UITableModelAdapter {
}
},
/**
* 第三列展示模板名
* 第三列展示替换后内容
*/
INDEX_2(2) {
@Override
public @Nullable Object returnContentObject(ITContent content) {
return content.getAfterReplaceStr();
}
},
/**
* 第四列展示模板名
*/
INDEX_3(3) {
@Override
public Object returnContentObject(ITContent content) {
return " " + content.getTemplateName();
@ -137,9 +162,9 @@ public class ITTableEditor extends UITableModelAdapter {
},
/**
* 展示Sheet
* 展示Sheet
*/
INDEX_3(3) {
INDEX_4(4) {
@Override
public Object returnContentObject(ITContent content) {
return " " + content.getSheetName();
@ -147,18 +172,18 @@ public class ITTableEditor extends UITableModelAdapter {
},
/**
* 展示块名组件名
* 展示块名组件名
*/
INDEX_4(4) {
INDEX_5(5) {
@Override
public Object returnContentObject(ITContent content) {
return " " + content.getBlockName();
}
},
/**
* 展示路径
* 展示路径
*/
INDEX_5(5) {
INDEX_6(6) {
@Override
public Object returnContentObject(ITContent content) {
return " " + content.getOtherPos();
@ -166,9 +191,9 @@ public class ITTableEditor extends UITableModelAdapter {
},
/**
* 展示定位按钮
* 展示定位按钮
*/
INDEX_6(6) {
INDEX_7(7) {
@Override
public Object returnContentObject(ITContent content) {
return content;
@ -209,4 +234,38 @@ public class ITTableEditor extends UITableModelAdapter {
return null;
}
}
/**
* 用于展示指定风格的checkbox的Editor
*/
public class ITBooleanEditor extends DefaultCellEditor {
public ITBooleanEditor() {
super(new UICheckBox());
UICheckBox checkBox = (UICheckBox) getComponent();
checkBox.setHorizontalAlignment(UICheckBox.CENTER);
}
}
/**
* 用于展示指定风格的checkbox的渲染器
*/
public class ITBooleanRenderer extends UICheckBox implements TableCellRenderer, UIResource {
public ITBooleanRenderer() {
super();
setHorizontalAlignment(JLabel.CENTER);
setBorderPainted(true);
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
ITContent content = (ITContent) table.getValueAt(row, ITReplaceSouthPanel.CONTENT_INDEX);
setEnabled(!content.isReplaced());
setSelected((value != null && ((Boolean) value).booleanValue()));
setUI(getUICheckBoxUI());
setBorder(BorderFactory.createEmptyBorder());
setBackground(Color.WHITE);
return this;
}
}
}

46
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java

@ -5,6 +5,7 @@ import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
@ -14,7 +15,6 @@ import com.fr.design.mainframe.share.ui.base.MouseClickListener;
import com.fr.stable.StringUtils;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
@ -85,27 +85,30 @@ public class ITTableEditorPane<T> extends BasicPane {
/**
* 改变面板的各个状态替换按钮表头勾选框
*
* @param content
* @param row
* @param col
*/
public void changeComponentStatus(ITContent content, int row, int col) {
if (content.isSelected()) {
content.setSelected(false);
editTable.setValueAt(content.isSelected(), row, col);
ITReplaceMainDialog.selectCount--;
//如果没有选中,替换按钮需要置灰
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(ITReplaceMainDialog.selectCount > 0);
} else {
content.setSelected(true);
editTable.setValueAt(content.isSelected(), row, col);
ITReplaceMainDialog.selectCount++;
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(true);
}
//更新表头的勾选框状态
if (editTable.getTableHeader().getDefaultRenderer() instanceof ITHeaderRenderer) {
ITHeaderRenderer renderer = (ITHeaderRenderer) editTable.getTableHeader().getDefaultRenderer();
renderer.refreshHeader(editTable, ITReplaceMainDialog.selectCount >= editTable.getRowCount());
if (!content.isReplaced()) {
if (content.isSelected()) {
content.setSelected(false);
editTable.setValueAt(content.isSelected(), row, col);
ITReplaceMainDialog.selectCount--;
//如果没有选中,替换按钮需要置灰
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(ITReplaceMainDialog.selectCount > 0);
} else {
content.setSelected(true);
editTable.setValueAt(content.isSelected(), row, col);
ITReplaceMainDialog.selectCount++;
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(true);
}
//更新表头的勾选框状态
if (editTable.getTableHeader().getDefaultRenderer() instanceof ITHeaderRenderer) {
ITHeaderRenderer renderer = (ITHeaderRenderer) editTable.getTableHeader().getDefaultRenderer();
renderer.refreshHeader(editTable, ITReplaceMainDialog.selectCount >= editTable.getRowCount());
}
}
}
@ -125,11 +128,11 @@ public class ITTableEditorPane<T> extends BasicPane {
*/
public static class ITHeaderRenderer implements TableCellRenderer {
JTableHeader tableHeader;
final JCheckBox selectBox;
final UICheckBox selectBox;
public ITHeaderRenderer(JTable table) {
this.tableHeader = table.getTableHeader();
selectBox = new JCheckBox();
selectBox = new UICheckBox();
selectBox.setSelected(true);
tableHeader.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
@ -217,7 +220,10 @@ public class ITTableEditorPane<T> extends BasicPane {
ITReplaceMainDialog.getInstance().getNorthPane().getReplaceButton().setEnabled(value);
}
for (int i = 0; i < len; i++) {
((ITContent) (getEditTable().getValueAt(i, ITReplaceSouthPanel.CONTENT_INDEX))).setSelected(value);
ITContent content = ((ITContent) (getEditTable().getValueAt(i, ITReplaceSouthPanel.CONTENT_INDEX)));
if (!content.isReplaced()) {
content.setSelected(value);
}
}
}

7
designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java

@ -5,6 +5,7 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chart.web.ChartHyperPoplink;
import com.fr.design.actions.replace.action.content.js.JSCheckTag;
import com.fr.design.actions.replace.action.content.js.SearchChartJSAction;
import com.fr.design.actions.replace.info.JSInfo;
import com.fr.design.actions.replace.info.base.ITContent;
@ -68,7 +69,7 @@ public class SearchJSUtils {
ITContent newContent = ITContent.copy(content);
newContent.setReplaceObject(listener);
SearchJSUtils.addJSInfos(jsInfos, new JSInfo(newContent));
} else if (javaScript instanceof Commit2DBJavaScript){
} else if (javaScript instanceof Commit2DBJavaScript) {
dealCommit2DBJS(jsInfos, content, (Commit2DBJavaScript) javaScript);
}
}
@ -90,7 +91,7 @@ public class SearchJSUtils {
if (javaScript instanceof JavaScriptImpl) {
newContent.setReplaceObject(javaScript);
jsInfos.add(new JSInfo(newContent));
} else if (javaScript instanceof Commit2DBJavaScript){
} else if (javaScript instanceof Commit2DBJavaScript) {
dealCommit2DBJS(jsInfos, newContent, (Commit2DBJavaScript) javaScript);
}
}
@ -362,6 +363,8 @@ public class SearchJSUtils {
newContent.addOtherPos(Toolkit.i18nText("Fine-Design_Report_Hyperlink"));
newContent.setReplaceObject(nameJavaScript);
newContent.addOtherPos(nameJavaScript.getName());
newContent.setHoldObject(elem);
newContent.setTag(JSCheckTag.CELL_HYPERLINK);
SearchJSUtils.addJSInfos(jsInfos, new JSInfo(newContent));
} else if (isChartHyperPopLinkValid(javaScript)) {
ITContent chartContent = ITContent.copy(content);

86
designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java

@ -1,7 +1,9 @@
package com.fr.design.actions.replace.utils;
import com.fr.design.actions.replace.info.Info;
import com.fr.design.actions.replace.ui.ITReplaceMainDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.combination.Pair;
@ -97,6 +99,22 @@ public class ShowValueUtils {
}
}
/**
* 获取高亮后用于展示的搜索后内容
*
* @param str 原内容
* @param searchStr 搜索内容
* @param replaceStr 替换内容
* @return 处理完的文本
*/
public static String getReplaceString(String str, String searchStr, String replaceStr) {
if (StringUtils.isEmpty(searchStr)) {
return str;
} else {
return updateReplaceHighlight(str, searchStr, replaceStr);
}
}
/**
* 替换策略
*
@ -187,6 +205,40 @@ public class ShowValueUtils {
}
}
/**
* 更新替换后的高亮
*
* @param str
* @param searchStr
* @param replaceStr
* @return
*/
public static String updateReplaceHighlight(String str, String searchStr, String replaceStr) {
if (ITReplaceMainDialog.isMatched()) {
String result = str;
Pattern pattern = containPattern;
Matcher matcher = pattern.matcher(str);
int size = FONT_HEAD.length() + FONT_TAIL.length();
int different = getDifferent(searchStr.length(), replaceStr.length());
int index = 0;
StringBuilder builder = new StringBuilder(str);
while (matcher.find()) {
builder.replace(matcher.start() + index, matcher.end() + index, FONT_HEAD + changeHtmlStr(replaceStr) + FONT_TAIL);
index += getDifferent(size, different);
index += getIncreaseCount(replaceStr);
}
return changeOriginHtmlStr(HEAD + builder.toString() + TAIL);
} else {
String ans = HEAD + replaceAll(str, searchStr, FONT_HEAD + changeHtmlStr(replaceStr) + FONT_TAIL) + TAIL;
return changeOriginHtmlStr(ans);
}
}
private static int getDifferent(int searchLength, int replaceLength) {
return searchLength - replaceLength;
}
/**
* 用于处理原字符串中的尖括号
*/
@ -315,4 +367,38 @@ public class ShowValueUtils {
public static String joinStr4Position(String... strings) {
return StableUtils.join(strings, JOIN_GAP_STRING);
}
/**
* 更新替换后内容的高亮
*
* @param info 存储信息的数据结构
* @param str 原内容
* @param searchStr 搜索内容
* @param replacedStr 替换内容
*/
public static void updateAfterReplaceStr(Info info, String str, String searchStr, String replacedStr) {
info.getContent().setAfterReplaceStr(ShowValueUtils.getReplaceString(str, searchStr, replacedStr));
}
/**
* 获取搜索或替换后的提示
*
* @param findCount
* @param replaceCount
* @param failedCount
* @return
*/
public static String getResultTip(int findCount, int replaceCount, int failedCount) {
StringBuilder str = new StringBuilder();
str.append("<html>").append(Toolkit.i18nText("Fine-Design_Replace_Search_Finish")).append("<font color = 'rgb(61,153,249)'>").append(findCount).append("</font>").append(Toolkit.i18nText("Fine-Design_Replace_Result"));
if (replaceCount != 0) {
str.append(Toolkit.i18nText("Fine-Design_Replace_Also_Finish")).append("<font color = 'rgb(61,153,249)'>").append(replaceCount).append("</font>").append(Toolkit.i18nText("Fine-Design_Replace_Result_Count"));
if (failedCount != 0) {
str.append(Toolkit.i18nText("Fine-Design_Replace_Have")).append("<font color = 'rgb(236,124,125)'>").append(failedCount).append("</font>").append(Toolkit.i18nText("Fine-Design_Replace_Can_Not_Replace"));
}
}
return str.toString();
}
}

Loading…
Cancel
Save