From c1c17b85932d5138940757dfc8c6648d93c64aee Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 27 Sep 2022 12:05:19 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-75998=20=E5=AE=8C=E5=96=84=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=B1=9E=E6=80=A7-=E6=8E=92=E5=BA=8F=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/AllowAuthorityEditAction.java | 1 + .../fr/design/module/DesignModuleFactory.java | 4 +++ .../fr/design/preview/DeveloperPreview.java | 1 + .../actions/replace/ITReplaceAction.java | 1 + .../content/formula/FormulaReplaceObject.java | 30 +++++++++++++++++++ .../replace/ui/ITReplaceMainDialog.java | 14 --------- .../replace/utils/ReplaceOperator.java | 22 ++------------ 7 files changed, 40 insertions(+), 33 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index 2b1ad225ac..546a702979 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -61,6 +61,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); + //进入时要关闭查找替换面板 DesignModuleFactory.getReplaceOperator().close(); //画虚线 diff --git a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java index 166ea80b1f..272daa7f5c 100644 --- a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java +++ b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java @@ -141,6 +141,10 @@ public class DesignModuleFactory { replaceHelper = replace; } + /** + * 获取查找替换面板的操作类 + * @return + */ public static ITReplaceHelper getReplaceOperator() { return replaceHelper; } diff --git a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java index 07d40053c1..176c44fe01 100644 --- a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java +++ b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java @@ -48,6 +48,7 @@ public class DeveloperPreview extends AbstractPreviewProvider { @Override public void onClick(JTemplate jt) { super.onClick(jt); + //进入时要关闭查找替换面板 DesignModuleFactory.getReplaceOperator().close(); SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId()); if (worker instanceof CallbackSaveWorker) { diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java index 1a9f67bb8a..358dc19652 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java @@ -55,6 +55,7 @@ public class ITReplaceAction extends UpdateAction { */ public void actionPerformed(ActionEvent event) { ITReplaceMainDialog mainFrame = ITReplaceMainDialog.getInstance(); + mainFrame.fitScreen(); mainFrame.setVisible(true); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java index e002832656..6260565551 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/FormulaReplaceObject.java @@ -22,6 +22,7 @@ import com.fr.main.impl.WorkBook; import com.fr.report.cell.cellattr.CellInsertPolicyAttr; import com.fr.report.cell.cellattr.core.RichChar; import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.report.core.sort.sortexpression.FormulaSortExpression; import com.fr.stable.FormulaProvider; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; @@ -495,6 +496,35 @@ public enum FormulaReplaceObject implements DealWithInfoValue { public boolean check(Info info) { return true; } + }, + /** + * 排序 + */ + FORMULA_SORT_EXPRESSION("FormulaSortExpression"){ + @Override + public Map getValue(Object... o) { + HashMap map = new HashMap<>(); + if (StringUtils.isNotEmpty(((FormulaSortExpression) o[0]).getFormula())) { + map.put("content", ((FormulaSortExpression) o[0]).getFormula()); + } + return map; + } + + @Override + public void setValue(Info info, String findStr, String replaceStr, List> operatorArray) { + Object replaceObject = info.getContent().getReplaceObject(); + info.updateOldStr((((FormulaSortExpression) replaceObject).getFormula()), findStr); + ((FormulaSortExpression) replaceObject).setFormula(ShowValueUtils.replaceAll((((FormulaSortExpression) replaceObject).getFormula()), findStr, replaceStr)); + } + + @Override + public boolean check(Info info) { + if (info.getContent().getReplaceObject() instanceof FormulaSortExpression){ + FormulaSortExpression sortExpression = (FormulaSortExpression) info.getContent().getReplaceObject(); + return StringUtils.equals(sortExpression.getFormula(), info.getContent().getOldShowStr()); + } + return false; + } } ; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java index 784821b8fd..f6fd8b6dc4 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java @@ -52,7 +52,6 @@ public class ITReplaceMainDialog extends UIDialog { private ITReplaceWestPanel westPanel; private boolean searchFlag; private String searchStr; - private static boolean existed = false; public ITReplaceMainDialog() { super(DesignerContext.getDesignerFrame()); @@ -67,7 +66,6 @@ public class ITReplaceMainDialog extends UIDialog { initFrame(); fitScreen(); ITReplaceFlag = true; - existed = true; } /** @@ -83,7 +81,6 @@ public class ITReplaceMainDialog extends UIDialog { } } } - setExisted(true); return instance; } @@ -312,17 +309,6 @@ public class ITReplaceMainDialog extends UIDialog { } } - /** - * 面板是否存在 - * @return - */ - public static boolean isExisted() { - return existed; - } - - public static void setExisted(boolean existed) { - ITReplaceMainDialog.existed = existed; - } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java index 4ce50e4ef4..e405c6be5f 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java @@ -13,29 +13,13 @@ import com.fr.design.actions.replace.ui.ITReplaceMainDialog; public class ReplaceOperator implements ITReplaceHelper { /** - * 进入权限编辑状态&开发者调试时关闭面板 + * 关闭面板 + * (当前关闭时机:进入权限编辑状态&开发者调试) */ @Override public void close(){ - if (isExisted()){ - ITReplaceMainDialog.getInstance().dispose(); - setExisted(false); - } + ITReplaceMainDialog.getInstance().dispose(); } - /** - * 面板是否存在 - * @return - */ - public boolean isExisted(){ - return ITReplaceMainDialog.isExisted(); - } - /** - * 设置面板存在属性 - * @param existed - */ - public void setExisted(boolean existed){ - ITReplaceMainDialog.setExisted(existed); - } }