From a35cfde57c6883266c66b7b3f0cfd12c249d8853 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 27 Sep 2022 11:16:14 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-75998=20=E6=94=B9=E5=8F=98=E5=BA=95?= =?UTF-8?q?=E5=B1=82=E5=85=B3=E9=97=AD=E9=9D=A2=E6=9D=BF=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/AllowAuthorityEditAction.java | 4 +- .../actions/help/replace/ITReplaceUtils.java | 26 ------------ .../fr/design/module/DesignModuleFactory.java | 12 +++--- .../fr/design/preview/DeveloperPreview.java | 5 +-- .../replace/ui/ITReplaceMainDialog.java | 20 ++++----- .../replace/utils/ReplaceOperator.java | 41 +++++++++++++++++++ .../actions/replace/utils/ShowValueUtils.java | 7 ++-- .../fr/start/module/DesignerActivator.java | 5 ++- 8 files changed, 63 insertions(+), 57 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java create mode 100644 designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java 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 c7287ad838..2b1ad225ac 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 @@ -1,9 +1,9 @@ package com.fr.design.actions; import com.fr.base.vcs.DesignerMode; -import com.fr.design.actions.help.replace.ITReplaceUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; +import com.fr.design.module.DesignModuleFactory; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; @@ -61,7 +61,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction { DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); - ITReplaceUtils.close(); + DesignModuleFactory.getReplaceOperator().close(); //画虚线 return true; diff --git a/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java b/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java deleted file mode 100644 index fe7ba9d8c3..0000000000 --- a/designer-base/src/main/java/com/fr/design/actions/help/replace/ITReplaceUtils.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fr.design.actions.help.replace; - -import com.fr.design.module.DesignModuleFactory; -import com.fr.log.FineLoggerFactory; - -/** - * 工具类 - * - * @author Destiny.Lin - * @version 11.0 - * created by Destiny.Lin on 2022-09-27 - */ -public class ITReplaceUtils { - - - /** - * 进入权限编辑&开发者调试时要关闭面板 - */ - public static void close(){ - try { - DesignModuleFactory.getReplacePane().newInstance().close(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } -} 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 2c75509f52..166ea80b1f 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 @@ -51,7 +51,7 @@ public class DesignModuleFactory { private Class ITReplaceAction; private Class formParaDesigner; private Class paraPropertyPane; - private Class replacePane; + private static ITReplaceHelper replaceHelper; private Class formHierarchyPaneCls; private Class widgetPropertyPane; private Class buttonDetailPaneClass; @@ -135,14 +135,14 @@ public class DesignModuleFactory { /** * 注册一下查找替换面板 - * @param r + * @param */ - public static void registerReplacePane(Class r) { - instance.replacePane = r; + public static void registerReplace(ITReplaceHelper replace) { + replaceHelper = replace; } - public static Class getReplacePane() { - return instance.replacePane; + public static ITReplaceHelper getReplaceOperator() { + return replaceHelper; } public static void registerParaPropertyPaneClass(Class p) { 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 e8be79b641..07d40053c1 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 @@ -1,7 +1,5 @@ package com.fr.design.preview; -import com.fr.design.actions.help.replace.ITReplaceHelper; -import com.fr.design.actions.help.replace.ITReplaceUtils; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.fun.impl.AbstractPreviewProvider; @@ -12,7 +10,6 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.worker.WorkerManager; import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.general.web.ParameterConstants; -import com.fr.log.FineLoggerFactory; import java.util.HashMap; import java.util.Map; @@ -51,7 +48,7 @@ public class DeveloperPreview extends AbstractPreviewProvider { @Override public void onClick(JTemplate jt) { super.onClick(jt); - ITReplaceUtils.close(); + DesignModuleFactory.getReplaceOperator().close(); SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId()); if (worker instanceof CallbackSaveWorker) { CallbackSaveWorker callbackSaveWorker = (CallbackSaveWorker) worker; 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 f6c82d8890..784821b8fd 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 @@ -6,6 +6,7 @@ import com.fr.design.actions.replace.action.ShowSearchResultAction; import com.fr.design.actions.replace.info.Info; +import com.fr.design.actions.replace.utils.ShowValueUtils; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.UIDialog; import com.fr.design.file.HistoryTemplateListCache; @@ -29,6 +30,7 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; +import java.util.regex.Pattern; import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable; @@ -39,7 +41,7 @@ import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable; * @version 11.0 * created by Destiny.Lin on 2022-08-10 */ -public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { +public class ITReplaceMainDialog extends UIDialog { List searchResultList = new ArrayList<>(); private static boolean ITReplaceFlag = false; private static boolean matched = false; @@ -81,7 +83,7 @@ public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { } } } - instance.fitScreen(); + setExisted(true); return instance; } @@ -285,6 +287,7 @@ public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { itTableEditor.clear(); String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText(); setSearchStr(searchStr); + ShowValueUtils.containPattern = Pattern.compile(ShowValueUtils.changeRegex(searchStr)); ShowSearchResultAction searchAction = ShowSearchResultAction.match(GeneralUtils.objectToString(northPane.getFindCombobox().getSelectedItem())); if (searchAction != null) { searchResultList = searchAction.addMatchResult(searchStr, searchAction.showSearchValue(jTemplate)); @@ -313,7 +316,7 @@ public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { * 面板是否存在 * @return */ - public boolean isExisted() { + public static boolean isExisted() { return existed; } @@ -322,16 +325,7 @@ public class ITReplaceMainDialog extends UIDialog implements ITReplaceHelper { } - /** - * 进入权限编辑状态&开发者调试时关闭面板 - */ - @Override - public void close(){ - if (isExisted()){ - getInstance().dispose(); - setExisted(false); - } - } + /** * 检测结果是否合法 */ 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 new file mode 100644 index 0000000000..4ce50e4ef4 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceOperator.java @@ -0,0 +1,41 @@ +package com.fr.design.actions.replace.utils; + +import com.fr.design.actions.help.replace.ITReplaceHelper; +import com.fr.design.actions.replace.ui.ITReplaceMainDialog; + +/** + * 操作面板 + * + * @author Destiny.Lin + * @version 11.0 + * created by Destiny.Lin on 2022-09-27 + */ +public class ReplaceOperator implements ITReplaceHelper { + + /** + * 进入权限编辑状态&开发者调试时关闭面板 + */ + @Override + public void close(){ + if (isExisted()){ + ITReplaceMainDialog.getInstance().dispose(); + setExisted(false); + } + } + + /** + * 面板是否存在 + * @return + */ + public boolean isExisted(){ + return ITReplaceMainDialog.isExisted(); + } + + /** + * 设置面板存在属性 + * @param existed + */ + public void setExisted(boolean existed){ + ITReplaceMainDialog.setExisted(existed); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java index 7ea1bdbbd0..438c3d98c7 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ShowValueUtils.java @@ -28,6 +28,7 @@ public class ShowValueUtils { public static final String ANY_THING_REGEX = "."; public static final String NUMBER_REGEX = "[0-9]"; public static final String ENGLISH_REGEX = "[a-zA-Z]"; + public static Pattern containPattern; private static List specialCharList = new ArrayList<>(); static { @@ -182,8 +183,7 @@ public class ShowValueUtils { public static int indexOf(String str, String regexStr) { CharSequence inputStr = str; int failReturn = -1; - String patternStr = changeRegex(regexStr); - Pattern pattern = Pattern.compile(patternStr); + Pattern pattern = containPattern; Matcher matcher = pattern.matcher(inputStr); if (matcher.find()) { return matcher.start(); @@ -199,8 +199,7 @@ public class ShowValueUtils { */ public static boolean contains(String originStr, String matchStr) { if (ITReplaceMainDialog.isMatched()) { - String str = changeRegex(matchStr); - Pattern pattern = Pattern.compile(str); + Pattern pattern = containPattern; Matcher matcher = pattern.matcher(originStr); return matcher.find(); } else { diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 1a04c79ac9..7e937911c3 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -32,7 +32,7 @@ import com.fr.design.actions.insert.flot.FormulaFloatAction; import com.fr.design.actions.insert.flot.ImageFloatAction; import com.fr.design.actions.insert.flot.TextBoxFloatAction; import com.fr.design.actions.replace.ITReplaceAction; -import com.fr.design.actions.replace.ui.ITReplaceMainDialog; +import com.fr.design.actions.replace.utils.ReplaceOperator; import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.env.DesignerWorkspaceLoader; @@ -467,12 +467,13 @@ public class DesignerActivator extends Activator implements Prepare { DesignModuleFactory.registerNewFormActionClass(NewFormAction.class); DesignModuleFactory.registerReplaceActionClass(ITReplaceAction.class); - DesignModuleFactory.registerReplacePane(ITReplaceMainDialog.class); DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class); DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class); DesignModuleFactory.registerFormHierarchyPaneClass(FormHierarchyTreePane.class); DesignModuleFactory.registerWidgetPropertyPaneClass(WidgetPropertyPane.class); DesignModuleFactory.registerButtonDetailPaneClass(FormSubmitButtonDetailPane.class); + + DesignModuleFactory.registerReplace(new ReplaceOperator()); DesignModuleFactory.registerParameterReader(new FormParameterReader()); StableFactory.registerMarkedClass(BaseJForm.XML_TAG, NewJForm.class);